How to convert a string to a date in sybase

cmsherratt picture cmsherratt · Sep 11, 2008 · Viewed 104.1k times · Source

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

select * 
from data
where dateVal < [THE DATE]

Answer

cmsherratt picture cmsherratt · Sep 11, 2008

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.