Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting carriage returns into script
Message
 
To
12/09/2008 14:23:29
General information
Forum:
Microsoft SQL Server
Category:
Scripting
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01347178
Message ID:
01347181
Views:
17
>I have a script that contains a line to insert data into the table. In one of those fields, I have a long text which insert carriage returns. When I generate the script, this wraps on several lines. And, when being run, it will generate an error. I need to adjust the script generation to take care of those carriage returns. I would assume I would have to do something like this:
>
>
>'First part of the string' + MyCarriageReturnValue+ 'Second part of the string'
>
>
>What is the best way to do this?

use REPLACE () function:
SELECT REPLACE(SomeField, CHAR(13)+CHAR(10),MyCarriageReturnValue) AS SomeField
FROM YourTable
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform