Skip to content
Archive of posts filed under the SQL Server category.

Cannot insert explicit value for identity column in table ‘table’ when IDENTITY_INSERT is set to OFF.

This error occurs when trying to insert into a column containing an identity. An Identity column is not able to be inserted into without the use of a special command mentioned below. Identity columns are columns that automatically increment when a value is inserted into a row. They are commonly used as primary keys because [...]

Best SQL Server Pagination Method

SQL Server 2011 actually employs a different method for pagination that is built in using the ORDER BY Clause. However for other versions, the most efficient pagination method is actually simple. Aren’t most things like this? It involves using (the mighty powerful) ROWCOUNT statement — twice. Anyways, the code: CREATE PROCEDURE [dbo].[spUsersPaged] ( @RowBegin int, [...]

Search Stored Procedure Text

Code snippet used to search within a stored procedure using the INFORMATION_SCHEMA.

SQL Server Interview Questions

Real world questions asked to real interviewees. These interview questions cover the different areas of SQL Development, data flow, and Database Administration.

Local Linked Server

When using OPENQUERY you will sometimes want to make calls to the same server you are working from. The most common reason for this is to query the output of a stored procedure into a temporary table. For that example, follow this link: (Insert Results of Stored Procedure Into Table) Before doing that you will [...]

Reindex All Tables in a Database

Code for reindexing all tables in a database using dbreindex