|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
get date of yesterday
i'm trying to get the date of yesterday via sql script
but it's not going verry succesfull. getting the date of today is no problem ; select getdate() but that also shows the current time witch i don't need. What i need is the date of yesterday without time. When using datepart i can retrieve an year or an moth, but when trying both : datepart (year,month, sqlcolumwithdate) i get an error : "the datepart function equires 2 arguments" So this is not working either, can annyone give me a hint / direction how to do this ? Thnx |
|
#2
|
||||
|
||||
|
try
Code:
datepart("d", -1, getdate())
|
|
#3
|
|||
|
|||
|
this is not allowed, 2 parameters
the correct statement is : Example : select fullname from employees where datediff (dd, lastworkingdaycolum, getdate()) = 1 This will show everybody who's lastworkingday was yesterday. this was needed for an scheduled vb application that creates an e-mail every morning showing employees that are inactive. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > get date of yesterday |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|