Technical Article

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

467 reads

Blogs

Daily Coping 19 May 2022

By

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

Running dynamic SQL in a different database

By

This is one of those things that on hindsight was a stupid problem, but...

VMware & SQL Server 823-824 alerts

By

We’ve been tracking a weird state with SQL Server virtual machines on VMware and...

Read the latest Blogs

Forums

Create Alert for Number of connection

By Nita Reddy

I have 2 columns , Count and Datetime I need to send alert for...

SQL Query Question

By Siva Ramasamy

Hello everyone, Thank you for looking into my question. I have a dataset like...

"Frankenrows"

By julian.fletcher

I'm not sure if that's the correct term for what we're seeing here, but...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers