Set statement with single quote in statement

  • I'm doing an update and the set field in the update is as follows: set description = '16"X14' PR F/G bead’. The problem I’m having is the single quote after the 14 is for feet, not to end the statement. How can I get around this? Thanks for your help.

    gsmith

  • You have to use dynamic sqk for this

    set description = '16"X14''' + 'PR F/G bead'

    -VG

  • Actually just putting two single quotes will give you the single quote without closing the string. You don't have to go to string addition.

    Here is an example.

    DECLARE @DESC VARCHAR(25)

    SET @DESC = '16"X14'' PR F/G BEAD'

    PRINT @DESC

    -Ben

  • Thanks everyone, that worked out great!

Viewing 4 posts - 1 through 3 (of 3 total)

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