Replacing double quote with single quote

  • Can someone please tell me what I did wrong here. I'd replaced the double quote with a single quote but it complained about Unclosed quotation mark before the character string '\n)'.

    HERE'S THE DOUBLE QUOTE VERSION:

    SET @Query_tmp = "BULK INSERT dbo.dbAnntest FROM '"+@TmpLocation+"' WITH (FIELDTERMINATOR = '\t', ROWTERMINATOR = '\n')"

    AND HERE'S THE SINGLE QUOTE VERSION:

    SET @Query_tmp = 'BULK INSERT dbo.dbAnntest FROM '+@TmpLocation+' WITH (FIELDTERMINATOR = ''\t'', ROWTERMINATOR = ''\n)

    Thanks

  • Try this Grasshopper:

    SET @Query_tmp = 'BULK INSERT dbo.dbAnntest FROM ' + @TmpLocation + ' WITH (FIELDTERMINATOR = ''\t'', ROWTERMINATOR = ''\n'')'

     

    NOTE: What appears to be double-quotes are actually 2 single quotation marks.  When using single quotation marks to delimit a character constant that contains an embedded single quotation mark, use two single quotation marks to represent the embedded single quotation mark.

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

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