The ‘Database’ Archives
Posted June 27, 2013 by

SQL Server 2012: Pagination with Order By and Offset Fetch

SQL Server Pagination with Order By and Offset Fetch in SQL Server 2012_1

Many times developers need to implement pagination on search results. Pagination is the process of dividing the results of a query into discrete numbered pages.

Category Database, SQL Server

Posted June 23, 2013 by

SQL Server: Coding the After Insert Trigger in SQL Server

After insert trigger in sql server 1

A trigger is a special type of stored procedure that is executed when an INSERT, DELETE or UPDATE statement modifies data in a table.

Category Database, SQL Server

Posted June 14, 2013 by

SQL Server 2012: Using Top with Percent in SQL Server

TOP with PERCENT SQL Server_1

The TOP clause in SQL Server is used to limit the number of rows in a result set. You can specify the number of rows or percentage of rows to be returned with the TOP clause.

Category Database, SQL Server

Posted May 29, 2013 by

SQL Server: Enable and Disable Triggers

Enable Disable Trigger SQL Server_1

If we have a trigger and want to prevent it from running, we can either delete the trigger or disable it temporarily. With the trigger disabled, it will not function. We have three ways to enable/disable a trigger in SQL Server by using a graphical option or by using a query editor.

Category Database, SQL Server

Posted March 20, 2013 by

SQL Server 2012: Find Expiry Date of SQL server


If you have installed SQL server 2012 Enterprise Evaluation Edition, this trial software will expire after 180 days without any pre alert notification. This SQL query will show the current version and edition of SQL Server you are using.

Category Database

Posted February 19, 2013 by

SQL Server 2012: How to Use IIF() Logical Function


SQL Server 2012 has introduced the new logical function IIF(). The behavior of function IIF() is quite similar to CASE and IF statements in SQL Server. Using IIF(), you can use fewer lines of code, and your code will be more readable.

Category Database

Posted February 9, 2013 by

SQL Server: Execute SQL Script Using SQLCMD Command Line


SQLCMD command line Utility is an alternative way to execute SQL scripts using the command line. This allows us to execute SQL scripts without touching SQL Server Management Studio (SSMS) GUI.

Category Database

Posted January 31, 2013 by

SQL Server 2012: How to Use CHOOSE() Logical Function


SQL Server 2012 introduced the powerful new CHOOSE() function. This tech-recipe will explore its use and common mistakes through some simple examples.

Category Database

Posted January 28, 2013 by

SQL Server: Check if Table or Database Already Exists


Errors warning that “there is already an object” and that the “database already exists” can easily be avoided by first determining if your table and database have already been created.

Category Database

Posted October 23, 2012 by

SQL Server: Copy One Table to Another Using Stored Procedure

Stored Procedure to copy one table to another.

When modifying an important table in the database, user frequently backup the table by making a copy of the original table with a different name. Using a stored procedure makes this process simple and convenient to reuse.

Category Database, SQL Server