UDF for date ranges around a given date (updated)

UDF - SQL 2000 and higherThis function returns an 18 row table of date ranges around a given date.The ranges are: Day, Week (Sunday to Saturday), Month, Quarter, Half Year, Year.For each range there are 3 values: Previous, Same and NextExample of usage:Joined to an orders table:Select r.period, count(o.order_id)from orders oinner join dbo.ufn_date_ranges('2003-04-01') ron o.order_date […]

2007-04-12 (first published: )

461 reads

Blogs

Azure Platform Series “You have exceeded the maximum amount of scale changes within the past hour”

By

This blog post relates to where you might be doing scale operations of your...

Bash: “command not found” in IF statement

By

This blog post is about a situation where writing an IF THEN ELSE statement...

The First Data Saturday is Tomorrow

By

Data Saturday #2 – Guatemala is tomorrow. This is the first event on the...

Read the latest Blogs

Forums

Calling remote powershell script through SQL server agent

By SQL_Surfer

I have a powershell script in remote server.  When I go to remote server...

Data Privacy Grows in California

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Data Privacy Grows in California

Grant user access to view database only

By sql_Reporter

Hi I need to grant a user access to a DB on the server...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers

Question of the Day

Amend a Commit

See possible answers