Usage of @@Error within transaction

@@ERROR returns error number of the last statement executed. When the last executed statement completed successfully, this returns 0. In case of any error, the error number will be return….

Read more »

Table variable and Table type in transaction

The myth is to roll back the work done inside the transaction, in case of any error during the transaction. However this is not the case with the SQL Server…

Read more »

Data compression overview in SQL Server 2008

I found the Data compression feature in SQL Server 2008 is very handy. This definitely helps in optimizing query performance in terms of I/O cost and additionally it helps in…

Read more »

How to insert values into an Identity column in SQL Server

Identity is a property that can be set on a column. When an identity is enabled the column will be populated automatically by system and it will not allow user…

Read more »

Be aware when you use two digit year in date

When you execute the below query, as you expect, the result will be “September 26th 2049” Now, Lets see what happen when we pass 50 instead of 49 You will…

Read more »

Concatenate column values from multiple rows into a single column in SQL Server

I have created a simple table to demonstrate how to concatenate the values from multiple rows in to one column. Insert some sample records in to this temporary table Once…

Read more »

JOIN in SQL – Inner Join and Outer Join

JOIN is one of the fundamental units of relational database system. Generally JOIN is used to combine related data from many tables to produce result. There are different types of…

Read more »

SELECT * Vs. SELECT COLUMNS – SQL Server Optimization Techniques

Don’t use * in SELECT query, instead use only required column This is one of the tips to optimize SELECT query. However, does this really give better performance in SQL…

Read more »