🗄️ SQL-Server
(47 posts)
T-SQL queries, performance tuning, security management, and administration guides for Microsoft SQL Server.
📅 2019-02-11
✍️ Bart Schelstraete
Looking for a table, but you don't remember which database it's located in? The code below will create a stored procedure, which you can use to find a table across multiple databases. CREATE…
Read more →
📅 2019-02-11
✍️ Bart Schelstraete
You can use the T-SQL code below to display the size of each table in a specific database. use MY_DATABASE_NAME go EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'" go
Read more →
📅 2019-02-11
✍️ Bart Schelstraete
Sometimes you need to do maintenance on a database, and you don't really want to use single-user mode or disable accounts. In that situation you could kill all connections to a specific database. In…
Read more →
📅 2017-08-14
✍️ Bart Schelstraete
You can create a temporary lock in T-SQL for — for example — testing: BEGIN TRAN SELECT 1 FROM TABLE WITH (TABLOCKX) WAITFOR DELAY '00:02:00' ROLLBACK TRAN GO
Read more →
📅 2017-06-07
✍️ Bart Schelstraete
from: http://jasonbrimhall.info/2014/01/02/day-9-queries-going-boom/ The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for…
Read more →
📅 2017-03-29
✍️ Bart Schelstraete
The following T-SQL statement returns the server name, server instance, instance, edition & version of the running SQL Server. SELECT SERVERPROPERTY('MachineName') AS [ServerName],…
Read more →
📅 2017-03-22
✍️ Bart Schelstraete
When tracing with SQL Profiler, it returned a query using 'sp_cursorprepexec'. When executing the same query within SSMS, it failed with: sp_cursorprepexec: The value of the parameter XX is invalid.…
Read more →