tags:

views:

7047

answers:

3

I need to specify a date value in a sybase where clause. For example:

select * 
from data
where dateVal < [THE DATE]
+3  A: 

Use the convert function, for example:

select * from data 
where dateVal < convert(datetime, '01/01/2008', 103)

Where the convert style (103) determines the date format to use.

cmsherratt
+1  A: 

Several ways to accomplish that but be aware that your DB date_format option & date_order option settings could affect the incoming format:

Select cast('2008-09-16' as date) convert(date,'16/09/2008',103) date('2008-09-16') from dummy ;

Jose B.
+2  A: 

Here's a good reference on the different formatting you can use with regard to the date:

http://www.compuspec.net/reference/database/sybase/function/convert.shtml

Edwin