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 […]

You rated this post out of 5. Change rating

2007-04-12 (first published: )

501 reads

Blogs

T-SQL Tuesday #197 – An impactful session or two from a conference – RECAP

By

Thanks to everyone who joined the blog party this month. I noticed three themes...

OpenClaw- Agentic Engineering

By

This week has training on AI – Cyber security experts – Omar Santos and...

Visualising Vectors in High Dimensional Space

By

Following on from my previous post on building The Burrito Bot, I want to...

Read the latest Blogs

Forums

What's new in R 4.6

By Steve Jones - SSC Editor

Comments posted to this topic are about the item What's new in R 4.6

Interesting Changes in R

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Interesting Changes in R, which...

PostgreSQL String Functions Part 1

By Shivayan Mukherjee

Comments posted to this topic are about the item PostgreSQL String Functions Part 1

Visit the forum

Question of the Day

Identities and Sequences V

When thinking about the identity property and sequence objects, which of these can generate values before an insert statement is executed?

See possible answers