My CheckDB Script

From time to time I get asked about checkDB, and there are many solutions out there, but I have one that I generally use that is very simple and does the job. The script below created a stored procedure in

Posted in Uncategorized Tagged with: , , , , , , ,

Updating SQL Server Statistics

Updating SQL Server statistics may not be as obvious as it may sound. Imagine this scenario. I invite you over for dinner and a game of Scrabble. After dinner, I start to do the dishes, while you set up the

Posted in Performance Tuning Tagged with: , , , , , , ,

What is a Page Split

Tables, and indexes are organized in SQL Server into 8K chunks called pages. If you have rows that are 100 bytes each, you can fit about 80 of those rows into a given page. If you update one of those

Posted in Performance, Performance Tuning Tagged with: , , , , , , ,

Simple Cursor Example : FORWARD_ONLY vs FAST FORWARD

First lets take a look at two queries using CURSORS, the first one will use the FORWARD_ONLY type cursor, and the second will use the FAST_FORWARD type cursor. These two types sound very similar, but perform quite differently. Now for

Posted in 70-461 Training, TSQL Tagged with: , , , , , , ,

T-SQL: A Listing Databases Example Using a Cursor

In SQL Server the cursor is a tool that is used to iterate over a result set, or to loop through each row of a result set one row at a time. It may not be the best way to

Posted in TSQL Tagged with: , , , , , , , ,

DBCC OutputBuffer

Being day 22 of the DBCC Command month at SteveStedman.com, today’s featured DBCC Command is DBCC OUTPUTBUFFER. I missed a few days on the DBCC Commands due to attending SQL Saturday in Redmond, and the release of my book on

Posted in DBCC Commands Tagged with: , , , , , ,

T-SQL: A Simple Example Using a Cursor

For more information on cursors, also take a look at the free SQL query training provided by Steve Stedman. In SQL Server the cursor is a tool that is used to iterate over a result set, or to loop through each

Posted in SQL 2008, SQL 2012, TSQL Tagged with: , , , , , , ,

T-SQL 2012 Procedure sp_describe_first_result_set

SQL Server 2012 adds a new stored procedure called sp_describe_first_result_set.  This new procedure returns metadata for the result set returned from a query. The metadata is information about what the results will look like.  sp_describe_first_result_set is an alternative to sp_columns, and appears

Posted in SQL 2012, SQL Saturday, TSQL, TSQL 2012 Tagged with: , , , , , , , ,