Cannot convert valid Char(24) date/time to date/time data type

  • Dennis Post (9/3/2013)


    I haven't been able to REPLACE the CHAR(0) nor have I been able to detect it with:

    Force a binary collation:

    replace(col COLLATE Latin1_General_BIN2, char(0), ' ')

    An non-binary SQL collation as suggested by Sean works too, but only with varchar.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

  • Hi All,

    Check this it will work:

    select * from CounterData

    where

    CONVERT(datetime,CONVERT(char(23),CounterDateTime),121)>dateadd(mi,-60,getdate())

    Thanks,

    Fouzan

  • Thanks. Was already resolved, but you code also works.



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

Viewing 3 posts - 16 through 17 (of 17 total)

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