Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
69 views

We have an End-to-End process which loads data into a Landing database. It used to run individual repopulate scripts for each data source in sequence, but that was taking more and more time to the ...
John Hunter's user avatar
2 votes
1 answer
86 views

We're using fulltext indexes in current builds of SQL Server and/or Azure SQL - compatibility levels well over SQL Server 2016 or higher, preferably SQL Server 2022 on Azure. While the searching in a ...
DinahMoeHumm's user avatar
-4 votes
1 answer
176 views

I found examples online using a recursive CTE to find all combinations of values that equal one target amount. The database column ledger_amount is DECIMAL(26,6). DECLARE @TARGET_AMOUNT DECIMAL(26, 6) ...
DoctorKennyG's user avatar
0 votes
1 answer
108 views

In SQL Server 2022, is there an aggregate function for doing a bit-wise OR against a particular column? -- Example table, data and output to show the different flags DECLARE @TEST TABLE (FLAGS TINYINT)...
freefaller's user avatar
1 vote
2 answers
126 views

I have a group of tables being updated/replaced by an outside process. I need to add a primary key to make my queries run faster. However, if the column I'm using is nullable, it obviously won't be ...
Johnny Bones's user avatar
  • 8,492
-1 votes
1 answer
65 views

I have two tables related to each other, each with roughly 200M records. CREATE TABLE [dbo].[AS_tblTBCDEF]( [CDEF_SOC_NUM] [numeric](5, 0) NULL, [CDEF_EFF_DATE] [date] NULL, [CDEF_TYP_BUS] ...
Johnny Bones's user avatar
  • 8,492
2 votes
1 answer
200 views

How can I select a service mark (SM) symbol in SQL? select CHAR(0153) --> ™ select CHAR(0174) --> ® select CHAR(0169) --> © What would the equivalent be for a SM symbol?
Jesse O's user avatar
  • 67
1 vote
1 answer
58 views

In a SELECT statement I want to convert .NET ticks to a datetime and display in Central Time. I don't want the timestamp+offset that "AT TIME ZONE 'Central Standard Time'" gives, I just want ...
Sam Clark's user avatar
2 votes
2 answers
132 views

My nvarchar value contains a control character - Start of Text (0x0002 / STX). I would like to include this in my XML value. Now I know XML is not tolerant of control characters so the only way I can ...
user31374527's user avatar
0 votes
2 answers
182 views

In many SQL error messages, SQL Server does not mention column name. But in messages such as the one shown below, the error message does include the column name. Question: How can we extract the ...
nam's user avatar
  • 24.2k
3 votes
1 answer
58 views

I need to extract data from a XML column in SQL Server 2016, for this example I'll create a XML variable, but in the real scenario the XML in inside a table so it is not editable. This is a sample of ...
FDB's user avatar
  • 1,112
1 vote
1 answer
81 views

I'm trying to import an XML file into a SQL Server table, there are no errors, but all values are 0 instead of the actual values. Could you please help me to understand what is wrong with my script? ...
Vladislav's user avatar
1 vote
1 answer
89 views

I have a number of system-versioned tables in my database. Microsoft notes here that... When you run any data modification queries on a temporal table, the Database Engine adds a row to the history ...
Leah's user avatar
  • 345
-1 votes
3 answers
162 views

Say I have a list of orders that looks like this: OrderId CustomerId ItemOrdered OrderedWhen 1 1 Orange 2024-08-01 16:33:00 2 1 Apple 2022-01-28 01:00:00 3 1 Peach 2025-06-10 03:39:00 4 1 Banana 2022-...
Vaccano's user avatar
  • 83.2k
0 votes
3 answers
175 views

I have a table of Accounts: AccountID Name 1 Account A 2 Account B 3 Account C 4 Account D 5 Account E and a table of CurrentAccounts: AccountID 2 4 The desired result of combining these two tables is:...
SezMe's user avatar
  • 537
0 votes
0 answers
92 views

Using Activebatch's JobStep library, I want to run a SELECT query in the T-SQLBlock job step, and have the output of that written to a file using the WriteTextToFile job step. Is there actually a way ...
Josh's user avatar
  • 141
1 vote
1 answer
146 views

I have an Azure Function built using .NET 8.0, which reads data from an Excel sheet and deletes all rows in Azure SQL Server, then adds around 67,000 new rows. I was doing this insert one by one with ...
microsoftdeveloperdesigner's user avatar
-2 votes
2 answers
149 views

I want to truncate a datetime(7) at different lengths - determined by parts - in SQL Server 2019 (DATETRUNC starts on 2022 *). Kind of "year-month", "year-month-day", ... up to ...
altink's user avatar
  • 375
1 vote
2 answers
197 views

create table #t(col varchar(10)) insert into #t values(1042800) select col, ROUND(col,2) as RoundVal from #t update #t set col = ROUND(col,2) The select col, ROUND(col,2) from #t returns - as ...
nam's user avatar
  • 24.2k
0 votes
1 answer
119 views

I'm monitoring my SQL Server environments (local setup, various versions like SQL Server 2017, 2019, 2022) and frequently encounter sessions that appear as sleeping but have sql_text and sql_command ...
Jvmnz_17's user avatar
0 votes
1 answer
128 views

I have source data that looks like this: USER_ID STATUS_GROUP STATUS START_TIME END_TIME DURATION 52a3246f6 Available Available 2025-05-18 19:00:30 2025-05-18 19:01:13 43 52a3246f6 On_Queue Idle 2025-...
Sean's user avatar
  • 21
-3 votes
1 answer
94 views

Currently I have hundreds of stored procedures that are in multiple servers, and that coexist with other stored procedures that are in other servers with linked server. The origin of this is that when ...
Angel Zapata Marquez's user avatar
0 votes
0 answers
54 views

I am trying the following: declare @V_SQL nvarchar(4000); declare @v_formula nvarchar(4000); declare @P_RESULT Varchar(5) ; set @v_formula = '1 AND 0' ; set @V_SQL = 'BEGIN if ' + @v_formula + ' ...
altink's user avatar
  • 375
3 votes
1 answer
87 views

I'm using the modify() and query() methods to interact with XML data. Here is an example of how I'm using modify(): DECLARE @i int = 1 DECLARE @x xml = N'<?xml version="1.0" encoding=&...
Leah's user avatar
  • 345
3 votes
1 answer
121 views

I have an application with the following requirements: Before a predefined event (in my application) occurs, I need to update and insert rows in different tables. After the event, certain rows in ...
MagicJP's user avatar
  • 85

1
2 3 4 5
1474