Friday, March 30, 2012

Replacing characters in SQL

I am incorporating a perl script loading data into my SQL Server. If I receive a message with a single backslash \ I know to replace it with a double backslash \\. But what if it is a " double quote what do I need to do to get it to appear as is?
ThanksYou'll love this answer: It depends.

Based on your previous message, you might have chosen to change the settings of QUOTED_IDENTIFIER. If you have changed it, then from Perl there is no way to pass a true double quote anymore. If you have not changed it, you don't need to do anything at all to a double quote.

My suggestion would be to leave the quoted identifier off, then use a simple s/'/''/gto fix up any apostrophes in the strings comming from Perl to SQL Server.

-PatP|||Thanks for you help.

-Laurasql

No comments:

Post a Comment