SQL SERVER – 2008 – Interview Questions and Answers – Part 8

Click here to get free chapters (PDF) in the mailbox SQL SERVER – 2008 – Interview Questions and Answers Complete List Download What is Data Compression? In SQL SERVE 2008 Data Compression comes in two flavors: Row Compression Page Compression Row Compression Row compression changes the format of physical storage…
Read More

SQL SERVER – 2008 – Interview Questions and Answers – Part 4

Click here to get free chapters (PDF) in the mailbox SQL SERVER – 2008 – Interview Questions and Answers Complete List Download 1) General Questions of SQL SERVER Which command using Query Analyzer will give you the version of SQL server and operating system? SELECT SERVERPROPERTY ('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY…
Read More

SQL SERVER – Few Useful DateTime Functions to Find Specific Dates

Recently I have recieved email from Vivek Jamwal, which contains many useful SQL Server Date functions. ----Today SELECT GETDATE() 'Today' ----Yesterday SELECT DATEADD(d,-1,GETDATE()) 'Yesterday' ----First Day of Current Week SELECT DATEADD(wk,DATEDIFF(wk,0,GETDATE()),0) 'First Day of Current Week' ----Last Day of Current Week SELECT DATEADD(wk,DATEDIFF(wk,0,GETDATE()),6) 'Last Day of Current Week' ----First Day of Last Week SELECT DATEADD(wk,DATEDIFF(wk,7,GETDATE()),0) 'First Day of Last Week' ----Last Day of Last Week SELECT DATEADD(wk,DATEDIFF(wk,7,GETDATE()),6) 'Last Day of Last Week' ----First Day of Current Month SELECT DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0) 'First Day of Current Month' ----Last Day of Current Month SELECT DATEADD(ms,- 3,DATEADD(mm,0,DATEADD(mm,DATEDIFF(mm,0,GETDATE())+1,0))) 'Last Day of Current Month' ----First Day of Last Month…
Read More

SQL SERVER – 2008 – Introduction to Merge Statement – One Statement for INSERT, UPDATE, DELETE

MERGE is a new feature that provides an efficient way to perform multiple DML operations. In previous versions of SQL Server, we had to write separate statements to INSERT, UPDATE, or DELETE data based on certain conditions, but now, using MERGE statement we can include the logic of such data modifications in one statement that even checks when the data is matched then just update it and when unmatched then insert it.

Read More