Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Need help with GETDATE()

Author  Topic 

b007
Starting Member

9 Posts

Posted - 2008-08-02 : 08:06:00
Hi,
I wonna get the day value (not the day number like 23 / 30)
I wonna get if it is Sunday / Monday ...

How to do that?
Thanks, Gil.

r937
Posting Yak Master

112 Posts

Posted - 2008-08-02 : 08:15:41
DATEPART(WEEKDAY,date)

rudy
http://r937.com/
Go to Top of Page

b007
Starting Member

9 Posts

Posted - 2008-08-02 : 08:27:11
Thanks.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-02 : 12:27:32
quote:
Originally posted by r937

DATEPART(WEEKDAY,date)

rudy
http://r937.com/


DATEPART wont return day value as Sunday,Monday ... it just returns the number of date in the week like 1,2... also its result depends on what you set as first date of week using SET DATEFIRST statement.The default value for DATEFIRST is 7 which will take Sunday as first day of the week if its U.S. and you can use @@DATEFIRST to see the currently set value.

To get day of week returned what you want is

DATENAME(WEEKDAY,datefield)





Go to Top of Page
   

- Advertisement -