Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

SQL Blog by Rahul Sahay

I have a total experience of 6 years primarily in databases (T-SQL and Performance Tuning). I have worked on different versions starting with SQL Server 2000 to SQL Server 2008 R2 for companies like Accenture and Airtel. I have completed Microsoft certification in MCTS (SQL SERVER). I did my MCA (Masters Of Computer Application) degree from Bangalore and have a BCA (Bachelor Of Computer Applications) from Indore.

Archives: February 2013

SQL BLOG: Using Triggers for creating history tables in SQL Server



Case Study:
1)       We  need to track the employee table in terms of new records inserted along with the datetime stamp

2)      In case any updation, we need to track the same with only the column name that is updated. Rest all columns should be null. All tracking…

Read more

1 comments, 551 reads

Posted in SQL Blog by Rahul Sahay on 28 February 2013

SQL BLOG: Calculating total number of days from 1st Jan without using DATEDIFF function

Below script will calculate total number of days based on the input from user from 1st Jan. Though we have a built in function DATEDIFF from which we can calculate this easily. But in the below script, i have tried calculating the days without this built in function.

I have…

Read more

0 comments, 289 reads

Posted in SQL Blog by Rahul Sahay on 25 February 2013

SQL BLOG: Calculating number of week along the days completed in that week for a given input date

Below code will display the week started along with the number of days completed in that week. For deriving this have used the modulo function.

Week-4 for this code starts from 22nd till the last day of the month, that's why week-4 remaining days are calculated by dividing with 21…

Read more

0 comments, 203 reads

Posted in SQL Blog by Rahul Sahay on 24 February 2013

SQL BLOG: Playing with Date Time

Below code returns remaining days in the month based on the input date. We can have this inside a function also which will return the integer value.


/* code starts here */

/* calculate remaining days in the month from the given input */
declare @tdate datetime
set @tdate =…

Read more

2 comments, 138 reads

Posted in SQL Blog by Rahul Sahay on 24 February 2013