SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Articles with tags T-SQL, Datetime Manipulation Rss

Search for any content tagged T-SQL & Datetime Manipulation

   Items 1 to 2 of 2   
 

SQL Server Function to Determine a Leap Year

I need to write a function to determine if particular year is a leap year (i.e. February contains 29 days rather than 28 days). I know that there are various rules for calculating leap years. Is there an easy way to figure this out? Can you provide an example or two to validate various years?  Read more...
By Additional Articles 2008/07/14 | Source: MSSQLTips.com | Category: Datetime Manipulation
Rating:  Rate this |  Briefcase | 3,445 reads

Working with Time Spans and Durations in SQL Server

What is the best way to return the "duration" of an event in SQL, given the start and end datetime values? How can we add up these durations to return grand totals? What data types should be used to return this data to our clients? How do we handle overflows, such as when hours go over 23 or minutes total up to over 59? Are there any T-SQL functions or other techniques that are useful in these scenarios?   Read more...
By Additional Articles 2007/10/24 | Source: SQLTeam.com | Category: T-SQL
Rating:  Rate this |  Briefcase | 2,767 reads
   Items 1 to 2 of 2