T SQL Date format convert function

If you ever wonder which one is really faster in Distinct vs Group By Performance Test then I will show some facts in this post so you can write your query accordingly.   To test distinct vs group by performance in SQL Query …

DISTINCT vs GROUP BY Performance in SQL Query Read more »

T SQL Date format convert function

In this post I will show you how to overwrite sql server backup file rather than append (default action is append to backup media set) If you try below t-sql command to take full sql server database backup then you …

How to overwrite SQL Server Backup rather than Append Mediaset Read more »

How to get parent child relationship using recursive CTE query

Many times we have to write recursive parent child query (Multiple levels of Parent-Child Links)  in SQL Server. There are multiple approaches to achieve this Using Hierarchy ID builtin CLR datatype in SQL Server 2008 or higher (not ion sql server …

SQL Server parent child query example using recursive CTE (Common Table Expression) Read more »

T SQL Date format convert function

 How many time you had to t sql date format date specific way such as yyyymmdd ??   Many people don’t know hidden feature of builtin T-SQL CONVERT function . This function can not only convert data types but also change format of  dates/numbers. …

SQL Date format using T-SQL CONVERT function (More than 40 formats) Read more »

T SQL Date format convert function

Recently I had to work on database migration project from SQL 2000 to SQL 2008 and one of the challenges you face is scripting correct permissions to new database. There is no way to script user permissions in right way …

How to Script user permissions for SQL Server 2000/2005/2008 for all or single user Read more »

T SQL Date format convert function

Northwind is my favorite database for trying out sample T-SQL scripts because of its simplicity. Here is the full script you can just copy/paste and run in SSMS (for sql server) or SQL Developer (for oracle) to create Northwind database …

Northwind Database Creation Script for SQL Server and Oracle Read more »

T SQL Date format convert function

If you ever try to update several millions of record in single Update statement then think several times because it can cause real pain. Disadvantage of single Update statement is … Its considered as single transaction and it doesn’t commit …

How to update large number of records in batch Read more »