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…
0 comments, 245 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…
I have…
0 comments, 61 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…
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…
0 comments, 45 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 =…
/* code starts here */
/* calculate remaining days in the month from the given input */
declare @tdate datetime
set @tdate =…
2 comments, 33 reads
Posted in SQL Blog by Rahul Sahay on 24 February 2013



Subscribe to this blog