- You can get the week-day by using the DATEPART scalar valued function of the SQL Server 2005. For example the following statement returns 1 (one) as it is default value for Sunday.
or
Result = 1
-------------------------------------------------------
The following are the default values for the week days:
SUNDAY = 1
MONDAY= 2
TUESDAY = 3
WEDNESDAY=4
THURSDAY= 5
FRIDAY = 6
SATURDAY = 7
SELECT DATEPART(dw,'07/22/2007' )
Result = 1
The following are the default values for the week days:
SUNDAY = 1
MONDAY= 2
TUESDAY = 3
WEDNESDAY=4
THURSDAY= 5
FRIDAY = 6
SATURDAY = 7
- Similarly you can check the quarter of the year by using one of the following query. SELECT DATEPART(quarter,'07/22/2007' ) or
SELECT DATEPART(qq,'07/22/2007' ) or
SELECT DATEPART(q,'07/22/2007' )
You can get the details from MSDN online, Here is the reference of the MSDN:
MSDN ONLINE
No comments:
Post a Comment