Monday, June 14, 2010

SQL Server DatePart and Abbrevations

The table lists date parts and abbreviations recognized by Microsoft SQL Server.

DatepartAbbreviations
yearyy, yyyy
quarterqq, q
monthmm, m
dayofyeardy, y
daydd, d
weekwk, ww
weekdaydw
hourhh
minutemi, n
secondss, s
millisecondms

Eg:
SELECT DATEPART(m, 0), DATEPART(d, 0), DATEPART(yy, 0)

No comments:

 
Feedback Form