Day name like "MON" from query 
Author Message
 Day name like "MON" from query
Hi
Can can't figure out how to get the day name from a date.
MON
TUE
WED
THU
FRI
SAT
SUN

In Oracle it is done like this: SELECT ....something.... WHERE WEEKDAY =
TO_CHAR(SYSDATE,'DY')



Sun, 29 Feb 2004 15:58:13 GMT
 Day name like "MON" from query

print datename( weekday, getdate() )

--
Tony Rogerson SQL Server MVP
Torver Computer Consultants Ltd
http://www.sql-server.co.uk


Quote:
> Hi
> Can can't figure out how to get the day name from a date.
> MON
> TUE
> WED
> THU
> FRI
> SAT
> SUN

> In Oracle it is done like this: SELECT ....something.... WHERE WEEKDAY =
> TO_CHAR(SYSDATE,'DY')



Sun, 29 Feb 2004 16:11:50 GMT
 Day name like "MON" from query
Use datepart.
DATEPART(dw, some date) returns an integer wich tells you what weekday it
is.
1 = sunday, 7 saturday

/Mattias


Quote:
> Hi
> Can can't figure out how to get the day name from a date.
> MON
> TUE
> WED
> THU
> FRI
> SAT
> SUN

> In Oracle it is done like this: SELECT ....something.... WHERE WEEKDAY =
> TO_CHAR(SYSDATE,'DY')



Sun, 29 Feb 2004 17:20:26 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. A "days at" query

2. max of ("...","...","..")

3. Help with Query "Invalid Object Name"

4. "~" in Field Name and SQL QUERY

5. "Unique Day" in a datetime field

6. Oracle's "Java Day"

7. Oracle's "Java Day"

8. How to make a "decimal"-field to an "integer"-field

9. pg_dump: query to get data of sequence "blahblahthis" returned name "blahblahthat"

10. "."and ","

11. "."and ","

12. The ""string""


 
Powered by phpBB® Forum Software