• damcguire (1/31/2014)


    actual data in the field is Number of Bene's

    among other things, this is the SQL I most recently tried

    Delete from rcd_def_dtl

    where rcd_prop_desc like '%''%'

    errors returned

    Msg 102, Level 15, State 1, Line 3

    Incorrect syntax near 's'.

    Msg 105, Level 15, State 1, Line 3

    Unclosed quotation mark after the character string ')

    Updating the field only would be okay, but ultimately we would like to delete the whole record.

    Thanks

    The code you posted will not return that syntax error. There must be something else you are doing.

    create table #rcd_def_dtl

    (

    rcd_prop_desc varchar(30)

    )

    insert #rcd_def_dtl

    select 'Number of Bene''s'

    select * from #rcd_def_dtl

    where rcd_prop_desc like '%''%'

    delete from #rcd_def_dtl

    where rcd_prop_desc like '%''%'

    select * from #rcd_def_dtl

    drop table #rcd_def_dtl

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/