Programming language used to interact with SQL Server databases
286 questions with SQL Server | SQL Server Transact-SQL tags
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
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
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
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
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
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
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
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
DBCC TRACEOFF 3604
Good afternoon SQL 2022 Standard I would like to better understand: DBCC TRACEOFF 3604 DBCC TRACEON 3604 How to use it? How to activate it? How and when should it normally be used? Thank you Urantia
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Sequel server licensing
My distributer is telling me that SQL Server Standard 2022 - 2 Core License Pack - 3 yearSQL Server Standard 2022 - 2 Core License Pack - 3 year billed annually is a perpetual license? I have query with this as it has a termed subscription time?…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Identity Column jumps massively from 168712 to 9999993
I have table with identity column id. There was massive jump from id 168712 to 9999993. It has happened twice in different servers. Its not identity cache/transaction rollback/manual insert/ reseed. Why its happening. Please guide me on this.
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
how to fix error 1205 on mssql 2022
Riscontro vari errori 1205 nei log e dopo alcuni di questi, si verifica l'errore 824
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
SQL query across linked servers
Hi All, I have a number of linked servers. In each server I have the same table Q_TESTS. I would like to run t-sql script across all the servers, select * from Q_TESTS where Act = 1 How can I achieve this? Kindly advise Many thanks
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases
Best, Most Efficient DATETIME filtering
I have seen many discussions regarding doing filtering against a DATETIME Data Type. Some suggest to use a true DATTETIME format. WHERE <DATETIME_Column_Name> >= '2026-02-17 00:00:00.000' Others suggest to use just a quoted Date... WHERE…
SQL Server | SQL Server Transact-SQL
Programming language used to interact with SQL Server databases