336,209 questions
Score of -3
1 answer
102 views
What is wrong with this SQL Server procedure? [closed]
I'm trying to create a SQL Server procedure in SSMS for the first time. My SSMS is version 21.5.14, which was released in 2025, and so should support the DROP PROCEDURE IF EXISTS clause, introduced in ...
Score of 0
0 answers
67 views
SSIS accessing blob storage via managed identity - Azure Storage connection manager vs azcopy?
We have a SQL Server (2022) SSIS package that we built that's using the Azure Storage Connection Manager to access blob storage via SAS tokens, but we want to move to using a managed identity on the ...
Score of 1
2 answers
115 views
How to combine pivot table columns?
I have created two separate temporary tables for ticket and sales per TPM using SQL Server.
For tickets:
select *
into #pivotticket
from
(select [month], [ID],[TPM], [day], [Tickets]
from #...
Score of -4
0 answers
210 views
Review my Star Schema design: Is storing changing customer attributes directly in the Fact table valid or flawed? [closed]
I am designing a star schema Data Warehouse for an e-commerce returns dataset (~60,000 records).
I would like to get a design review on my current schema: is this design logically sound and acceptable,...
Score of -7
0 answers
184 views
Day by day tickets and sales per POS [closed]
I have a ticket table consisting of the following columns:
sales date, terminal sales, ticket ID, price
I need help on how to make the results look like the one attached image.
I tried below sql ...
Score of 2
3 answers
213 views
How does one implement nested LEFT JOIN in "old style joins" on SQL Server 4.2
I'm trying to return some metadata from an old SQL Server 4.2, and I want all objects with columns but also objects without columns, like stored procedures etc.
This server doesn't support anything ...
Score of 0
1 answer
197 views
How to move the responsibility of executing some logic to the SQL Server instead of executing that logic inside the application? [closed]
I have an Excel file that contains many columns like this :
SKU
BarCode
EnglishName
ArabicName
Category
SubCategory
The problem: the data of that Excel file should be persisted into the appropriate ...
Score of 0
0 answers
91 views
Why does node-mssql connect to the primary replica when using ApplicationIntent=ReadOnly? [duplicate]
I have a SQL Server Always On Availability Group with one primary replica and one readable secondary replica.
I want my Node.js application to send read-only connections to the secondary replica.
I am ...
Score of -4
0 answers
182 views
Insert of XML record into SQL table through stored procedure call [closed]
I have a stored procedure that accepts an XML input parameter. Inside the procedure, I parse the XML data and attempt to insert the extracted values into a SQL Server table.
However, the insert ...
Score of 1
5 answers
165 views
Return multiple text and associated number from string
Trying to return all instances of a word and number from a string, I've put this together but only grabs the first occurrence as opposed to looping through the string to return all instances of text+...
Score of 0
1 answer
170 views
Not null column expects input value in stored procedure even though it is set to be an output parameter [closed]
This code worked fine several weeks ago, but suddenly started in with errors.
I have a situation where I have a column in a SQL Server database that is of the not null type. In my C# code, I call a ...
Score of 0
0 answers
276 views
Why is Dapper failing to substitute a parameter in a SQL statement
I have the following method in my code to query a table with an encrypted column in SQL Server.
public async Task<ConnectionDetails?> LoadConnectionDetailsBy(string systemId, CancellationToken ...
Score of 0
0 answers
10 views
SQL Server 2022 PSPO does not create multiple query plans for a highly skewed parameter [migrated]
I am trying to demonstrate Parameter Sensitive Plan Optimization (PSPO) in SQL Server 2022 using a highly skewed dataset.
My Orders table contains about 10 million rows:
OrderStatus = 1 → ~9,999,000 ...
Score of 0
0 answers
10 views
Why optimizer does not perform merge join in this particular query? [migrated]
I'm learning how SQL Server chooses join strategies and I hit a result I can't explain.
I have a transactions table (~10M rows) and a card_banlist table (~1M rows). I want every transaction that ...
Score of -1
2 answers
206 views
Why does the first database write take significantly longer than subsequent writes?
My application has some method called Write that writes data to a SQL Server database, The method first calls custom AddRange method which adds data to the context if it's not already tracked by the ...