This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
SQL Server Management Studio Query Results Window.

SQL SERVER – Get Last Running Query Based on SPID

July 19, 2009
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server DBCC, SQL System Table

How to see the last running query of another session based on its SPID, using @@SPID to find session IDs and DBCC INPUTBUFFER to read the query.

Read More
Gap in identity column.

SQL SERVER – Reseed Identity of Table – Table Missing Identity Values – Gap in Identity Column

April 1, 2009
Pinal Dave
SQL Tips and Tricks
SQL Identity, SQL Index, SQL Scripts, SQL Server DBCC, SQL System Table

Deleted rows left a gap in an identity column for my developer. Here is how to reseed identity of a table so new rows keep the sequence without gaps.

Read More
A row of old brass light switches, one held in the up position by a strip of yellowed, curling tape.

Trace Flags Worth Knowing About

March 14, 2009
Pinal Dave
SQL Tips and Tricks
DBA, SQL Server Configuration, SQL Server DBCC, TraceFlags

Review trace flags worth knowing about in current SQL Server, distinguish session, global, and startup scope, and verify each flag’s support.

Read More
Displaying AdventureWorks database files.

SQL SERVER – Shrinking NDF and MDF Files – A Safe Operation

January 25, 2009
Pinal Dave
SQL Performance
SQL Data Storage, SQL Scripts, SQL Server DBCC, SQL Server Security

Is shrinking NDF and MDF files safe? A reader asked if it causes data loss. It does not, but I explain why shrinking them is often not a good idea.

Read More
SQL SERVER - 2008 - 2005 - Find Longest Running Query - TSQL - Part 2

SQL SERVER – 2008 – 2005 – Find Longest Running Query – TSQL – Part 2

January 23, 2009
Pinal Dave
SQL Performance
Best Practices, SQL Scripts, SQL Server DBCC, SQL System Table

An updated script to find the longest running query in SQL Server 2005 and 2008, with the divide by zero error fixed and time now shown in milliseconds.

Read More
SQL Server performance query results.

SQL SERVER – Find Number of Rows and Disk Space Reserved – Using sp_spaceused Interesting Observation

January 14, 2009
Pinal Dave
SQL Tips and Tricks
SQL Data Storage, SQL Function, SQL Scripts, SQL Server DBCC, SQL Stored Procedure, SQL Utility

sp_spaceused shows the row count of a table and the disk space reserved. Here is why its numbers looked wrong on AdventureWorks and how @updateusage fixed them.

Read More
SQL SERVER - 2008 - 2005 - Find Longest Running Query - TSQL

SQL SERVER – 2008 – 2005 – Find Longest Running Query – TSQL

January 2, 2009
Pinal Dave
SQL Performance
SQL Scripts, SQL Server, SQL Server DBCC, SQL Stored Procedure

My company owner asked which query runs longest and I found no ready script, so I wrote one: the Longest Running Query with its average and maximum time.

Read More
Previous 1 … 7 8 9 10 11 12 13 … 16 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com