We store several sql statements in one of our tables. For example, the following SQL statement will be stored in [Validations].[SqlSource]
:
select
VendorId,
VendorName,
VendorAddress,
VendorCity,
VendorState,
VendorZip
from Vendor
The problem is that when we copy this SQL directly from the table, it'll lose the carriage returns. This means that pasting the sql will look like this:
select VendorId, VendorName, VendorAddress, VendorCity, VendorState, VendorZip from Vendor
It's not an issue with this sql since it's short, but when the SQL is long, then the string when pasting will be long.
Is there a way to keep the formatting when I copy the string and paste to a text editor?
I added an example of how it's inserted into the table:
create table toerase_SQL
(
SqlSource varchar(max)
)
insert into toerase_SQL
select
'select '+
'VendorId, '+
'VendorName, '+
'VendorAddress, '+
'VendorCity, '+
'VendorState, '+
'VendorZip '+
'from Vendor '
select * from toerase_SQL