Reputation: 25573
In SQL Server 2008, I create a table with a column(text). Then I want to put kind of formated data in in this column, for example more than one line like:
Line 1
Line 2
Line 3
If I copy and paste above data into the column, only first line data saved in the column. How to resolve this issue for both code and manual input(like MSSMS)?
Upvotes: 0
Views: 3254
Reputation: 453406
First, use varchar(max)
instead of text
. text
is deprecated and much less convenient to work with anyway.
Secondly you can include line breaks in string literals in TSQL.
Update YourTable
SET YourColumn = 'Line 1
Line 2
Line 3'
WHERE ...
And thirdly copying and pasting text containing line breaks into the SSMS editor works fine in my experience. You need to use the up and down arrows to see the other lines of text after pasting.
Upvotes: 1