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: )

464 reads

Blogs

Ethics in Modern Data at Music City Tech 2021

By

  On Sept 16, Christine and I presented our joint presentation on Ethics in Modern Data at...

Slides and Video from Building a Regret-free Foundation for your Data Factory Now Available

By

Last week, Kerry and I delivered a webinar with tips on how to set...

Daily Coping 16 Sep 2021

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Read the latest Blogs

Forums

How to grant Exec ON multiple Stored Procedures

By ArnolddG

Hi, I have multiple Stored Procedures that are named like _Test_01, _Test_02 _Test_03 I...

XML data extract

By dbayliss1978

Hi I've been tasked with extracting information for a report where the field type...

There is insufficient sys memory in resource pool 'internal' to run this query

By WhiteLotus

Hi All, I have an issue with production server , from SQL error log...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers