Problems with a simple CAST statement

  • Why if I run the 1st of the following 2 statements do I get and error, when both are valid dates?

    SELECT CAST('1976-12-14T00:00:00+02:00' as datetime)

    SELECT CAST('1976-12-14T00:00:01' as datetime)

    The error: Conversion failed when converting datetime from character string

    Regards

    MacPhil

  • The first isn't a valid time string

    use this instead:

    SELECT dateadd(hh, 2, CAST('1976-12-14T00:00:00' as datetime))

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply