Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server Quarter Interval 1

Status
Not open for further replies.

born2program

Technical User
Sep 18, 2006
85
US
I've been using functions like datepart for years and have used to get the date part of quarter before. My question is....Why does microsoft have several interval types available for quarter (ie. q, qq, quarter). For instance datepart(q,getdate()) and datepart(qq, getdate()) and datepart(quarter, getdate()) all return the same value, data type, etc. Is there a benefit to using one over the other and why do we have multiple to choose from?

Inquiring minds would like to know. Thanks.
 
I don't know for sure, but I suspect it is for backward compatibility reasons.

Personally, I prefer it completely spelled out "quarter", because I think it makes the code easier to read. You don't need to know the q or qq represents quarter.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Thanks. That's what I was thinking. Must be from a very old version of sql server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top