Consider the following situation:
1- An application reading a text file.
2- Maybe some of the records contain Single or Double quotes
3- The application must build a TSQL sentence to insert the data into the database
4- The data quotes could be at the beginning and/or the end of a field or perhaps in the middle.
5- How many adjacent quotes is not known
When enveloping the data field into single or double quotes and running it against SQL Server 2005 it raises an exception when there are quotes already into it.
Data: The Vendor's device is blue
SQL: INSERT INTO dbo.MyTable SELECT 'The Vendor's device is blue' -- This raises an error
Is there a way to change the strings delimitator to use for example pipes instead of quotes?
SQL: INSERT INTO dbo.MyTable SELECT |The Vendor's device is blue|