Programming language used to interact with SQL Server databases
292 questions with SQL Server | SQL Server Transact-SQL tags
KB5126149 cause SnowFlakeID broken in MS SQL Server
Below windows update package caused SnowFlakeID broken in MS SQL SERVER, this issue is very serious, caused all transactions cannot record, below are the KB and mapping windows version: OS .NET Update KB Vulnerabilities Addressed Win11 24H2 / 25H2…
SQL Server | SQL Server Transact-SQL
Partition elimination on SQL Server 2025 running on Azure VM querying files in Storage Account
I'm trying to get partition elimination to work when using OPENROWSET on SQL Server 2025 running on an Azure VM and querying files in an Storage Account with Hierarchical namespace enabled. I have no more ideas how to get it to work. My starting point…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Microsoft Fabric Warehouse Stored Procedure
Hello, I have a question about how a Fabric Warehouse accesses Lakehouse data. We have a stored procedure running in a Warehouse that references Lakehouse tables using syntax similar to the example below: SELECT DISTINCT end_reason_test FROM…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
filepath() and filename() causes syntax error in SQL Server 2025 and external table
We are currently running in SQL Server 2022 and use external tables on top of parquet files in a storage account. All the external table definitions looks something like this CREATE EXTERNAL TABLE [my_external_data] ( [column_a] [varchar](20)…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
How to auto-detect dead-lock condition
Some time SQL server hang-out due to in sufficient memory or dead lock. How to auto-detect dead-lock condition in SQL server, and I also want a notification email from SQL Agent.
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
BULK INSERT cannot access UNC path, error code 5 (Access is denied) using gMSA unless locally triggered
Running a stored procedure to bulk insert from a UNC path works locally via SSMS and via SQL agent job but if run remotely I receive Operating system error code 5 (access is denied). Please help as this workaround is not suitable for our…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Przy nadawaniu użytkownikowi 'sa' roli serveradmin otrzymuję komunikat błędu
Dzień dobry. Przy nadawaniu użytkownikowi 'sa' roli serveradmin otrzymuję komunikat błędu: TYTUŁ: Microsoft SQL Server Management Studio Operacja Dodaj członka nie powiodła się dla elementu ServerRole „serveradmin”. (Microsoft.SqlServer.Smo) Aby uzyskać…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
How to install SQL Server Management Studio for Personal Use
Hello, I would like to download the latest SQL Server Management Studio locally on my machine for personal use and training. I have been unemployed since Nov-2025 and I would like to maintain and increase my SQL skills. I would also like some basic…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Running total for grouped data
Given input data similar to: Month Region Store Sales Jan R1 S1 10.00 Jan R1 S1 15.00 Jan R1 S1 30.00 Jan R1 S2 5.00 Jan R1 S2 1.00 Jan R2 S3 17.00 Jan R2 S3 …
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Table constraint design to avoid a cycle
In the minimal reproducible example below, table C is invalid as it results in a cycle. I understand I can simplify C by removing the constraints, however the number of triggers required after goes up significantly if I want to preserve the cascading…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Does UPDATE WITH (ROWLOCK) guarantee row-level locking, or can SQL Server still acquire page/table locks and perform lock escalation?
Hi Team, I would like clarification on SQL Server locking behavior for an UPDATE statement when the ROWLOCK table hint is explicitly specified. Example: From Microsoft documentation, I understand that: ROWLOCK is a table hint that requests row-level…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
What is SQL error ID 8179 and how to fix it?
The customer often found NAV Server error at Event Viewer (Application log), Event ID 216, MicrosoftDynamicsNavServer$MBKNAV. It was NavSqlException, SQL error ID 8179 (“Could not find prepared statement with handle …”). This issue often occurs when…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Alternative to UNION
I have a UNION Query that is combining information from a History Table and the current Master Table. We are talking about a few million rows here. The problem is the amount of [tempdb] space it is allocating and using for the UNION. So we thought if we…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Stored Procedure running longer hours
Hello, I am facing currently issue as stored procedure running very longer hours although my DB is not that big means around 20 GB. We are also running OLA's maintenance solution for Update Stats Daily and Index maintenance weekly basis. Stored procedure…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Latest security update has caused SS debugger to fail... 2008 r2 windows 10 - Windows Firewall
Getting: The WIndows Firewall on this machine is currently blocking remote debugging. RD requires... TCP Port 135... UDP 4500/ 500 be unblocked. Can't Cancel, Unlock for local or Unlock for Computer. Trying to "Debug>Start Debugging".
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
How do I fix SQL Select Query?
image0.jpeg SSMS 22 generated select top 1000 rows produces an error as shown in the attached image. How do I fix this?
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Copying a 32-Million Row Table From Production Server to Test Server
So we believe we're having tempdb issues with a very wide table that has 32-Million Rows on it. There is no Primary Clustered Index, No Indexes defined on it at all. We have tried an INSERT SELECT going across a Linked Server to our Test Server to copy…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Implementing User-Defined Sort via Trigger
Hi, Running SQL Server 2008 R2. We have a requirement to implement an arbitrary sort for a table using a numeric sort column. DDL and DML below: CREATE TABLE [dbo].[Test] ( [TestID] [bigint] IDENTITY(1,1) NOT NULL, …
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
what data type i should use for roversion col and can i use less than greater than with it.
can i use Rowversioncol ( in my database it's synonyme timestamp is used) to run the following query to find all inseted after this @LastKnownRowVersion; SELECT * FROM YourTable WHERE RowVersionCol > @LastKnownRowVersion; data type i should use for…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
SQL error -An expression of non-boolean type specified in a context where a condition is expected
Thanks in advance for any help folks can offer. I've been pulling my hair our all day yesterday trying to figure out how to fix this. I received the error below after I added 3 new lines (line 60, 61 and 62). The original code without these 3 new lines…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases