2

I have a string eg. "2008-01-01 11:09:11".

How do I convert this to a datetime ?

PerformanceDBA
  • 32,198
  • 10
  • 64
  • 90
Sjemmie
  • 1,249
  • 8
  • 26
  • 31
  • Do you have that string outside of Sybase and you want to know how to insert it as a datetime? Or do you have the string in Sybase and you want to return it as a datetime? – DOK Dec 07 '09 at 16:31

2 Answers2

1

If you're using it as a literal string in, say, a SELECT statement or a stored procedure call, the conversion is automatic.

If you've got it in a variable, convert(datetime, @stringDateTime) should work.

Tim Robinson
  • 53,480
  • 10
  • 121
  • 138
-1

The timestamp datatype is defined as varbinary(8) null and does it have any relation at all to time or date.

You cannot convert timestamp to datetime in sybase.

aF.
  • 64,980
  • 43
  • 135
  • 198