|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Sql date help
I want to select only fields with todays date, I tried this but it dosen't work.
The data is stored in the DB like this. 2003-05-01 00:00:00.000 Select * from table WHERE DateField = '" & Date() & "' Thanks |
|
#2
|
|||
|
|||
|
Try to formate date
I think your problem might be that the two dates in the WHERE clause might not be in the same format. Try adding date_format to both date_field and date(). This way both dates in the WHERE will be in the same format. You can use a format string like %m %d %Y to return 06 22 2004. Hope it helps a little.
-Tim |
|
#3
|
|||
|
|||
|
try this,
Select * from table WHERE convert(varchar(10),DateField,110) = '" & format(Date(),"mm-dd-yyyy") & "' search for convert function in sql server help. 110 refers date in mm-dd-yyyy. similarly there are so many other formats. M.L.Srinivas |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Sql date help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|