Monday, November 17, 2014


This is a general mistake that many developers do and sometimes goes unnoticed while reviews and testing, but then suddenly one day start appearing as bugs. Many developers understand and (misinterpret) varchar as variable-length data type and hence doesn’t specify the length in the variable definitions which is incorrect. Here are some examples of ‘weird’ Read More

Friday, July 25, 2014

GetDate() V/s GetUTCDate()

Today my colleague asked me, what is the difference between GetDate() and GetUTCDate()? and I thought it would be a nice idea to blog about it. So here it is, my next article. In simple words the GetDate() returns the local time where as GetUTCDate() returns the GMT time. GETDATE() Returns the current database system Read More

Tuesday, July 1, 2014

Transfer Login to Replica servers

Recently I was working on configuring AlwaysOn replica setup. After a fail-over my application was not able to connect to the SQL server using the same SQL accounts. The error was “Login failed for user” The reason is SQL Server never replicates the SQL Server Login, though it replicates the database users. So on the Read More

Thursday, May 1, 2014

Foreign key indexing

Foreign keys are an essential part of a relational database. Foreign keys helps ensuring the data integrity at the logical level. However many time we forget to create proper indexes that support the foreign keys work effectively. So is there any benefits of indexing the foreign key columns?  It can give better performance when you delete Read More

Saturday, April 12, 2014

Deterministic Functions in SQL

Deterministic functions always return the same result whenever they are called with a specific set of input values provided the database state remains unchanged. Non-deterministic functions may return different results each time they are called with a specific set of input values even if the database state remains unchanged. In another word, we can predict the Read More

1 2 3 4