SQL Server Articles

Note: The articles listed here were originally published on SQLTeam.com. 

Introduction to Transactions

This article covers the basics of transactions and how they can be used to ensure data consistency.  It discusses committing and rolling back transactions and the proper way to trap errors inside transactions. ( Read More )

Using SQL Server's Metadata

The simplest definition I can find for metadata is simply "data about data". SQL Server has a number of different functions that you can use to query your database structure. This articles discusses the Information Schema views and functions such as ObjectProperty and ColumnProperty. ( Read More )

Deleting Duplicate Records

One of the most common problems in a database is deleting duplicate records when a primary key isn't defined.  This article describes different ways to complete this task. ( Read More )

The SQL_VARIANT Datatype

Microsoft introduced the sql_variant in SQL Server 2000. You can use the sql_variant to store data of an unspecified or inconsistant type. Or to store data of almost any SQL Server datatype. ( Read More )

Understanding Identity Columns

SQL Server uses identity columns to allow easy auto-numbering of inserted rows.  This article discusses many of the functions that allow you to manipulate these columns such as resetting the counter or finding the value of a just inserted identity column. ( Read More )

SQL Server Cursor Performance

A recent article on 4GuysFromRolla.com had an ASP script to generate the Transact-SQL code for a cursor. I've always thought that cursors where slower than set-based SQL but I never knew how much slower. Read on for the results and a couple of surprises thrown in. ( Read More )

Returning Data from Stored Procedures

This article discusses three common ways to return data from stored procedures:  OUTPUTing variables, temp tables and the RETURN statement. ( Read More )