Msg 241, Level 16, State 1, Line 2

  • Hi,

     

    I run this query and get these error results

     

    begin

    tran

    Update

    lsexceptions set workedby = 'dskuhrovec' where clearedate = 'Blank' AND loannum >='999824 <=1000085'

    rollback

    tran

     

    error received

    Msg 241, Level 16, State 1, Line 2

    Conversion failed when converting datetime from character string.

    anyone know how I can fix this?

     

    thanks,

     

  • >>where clearedate = 'Blank'

    What datatype is the [clearedate] column ? If it's a datetime, you can't compare it to the text 'blank'.

    Did you mean this:

    WHERE clearedate IS NULL

  • The cleardate is a date time

  • 2nd part of the reply was :

    Did you mean this:

    WHERE clearedate IS NULL

  • Yes NULL is the magic word. Thanks so much. You guys are great!

  • You need to fix this too: loannum >='999824 <=1000085'

    loannum

    Between '999824' And '1000085'


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

Viewing 6 posts - 1 through 5 (of 5 total)

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