bebblebrox
IS-IT--Management
Hi,
Any advice on the problem below? I have a 4 digit string representing a date which I can sucessfully convert when the year is prior to 2000. But, after 2000, I get a syntax error.
Any advice on the problem below? I have a 4 digit string representing a date which I can sucessfully convert when the year is prior to 2000. But, after 2000, I get a syntax error.
Code:
select convert(datetime,(substring(@date,1,2) + '01' + substring(@date,3,2)),101100)
1999-01-08 00:00:00.000
set @date = 0508
select convert(datetime,(substring(@date,1,2) + '01' + substring(@date,3,2)),101100)
Server: Msg 241, Level 16, State 1, Line 6
Syntax error converting datetime from character string.