Tomas
Tomas

Reputation: 18117

How to add multiline text in varchar(MAX) field

I have created varchar(MAX) field as memo field. Unfortunately I do not find a way how to add multiline text into such field using MS SQL Server Management Studio. If I use copy/paste of multiline text only first line of multiline test is inserted into varchar(MAX) field.

Upvotes: 14

Views: 20164

Answers (3)

Alex K.
Alex K.

Reputation: 175826

As you observe, if you paste in multi-line text only the first line is inserted, instead paste the text into an update statement and run that;

update T set fld =
'aaa
sss
ddd'
where ...

(You need to SELECT in results to text mode to observe the lines, in the grid view they appear as double-spaces)

Upvotes: 23

User
User

Reputation: 3274

You can use REPLACE('Line1@Line2@Line3', '@', CHAR(13) + CHAR(10)), for example.

Upvotes: 1

Anantha Sharma
Anantha Sharma

Reputation: 10098

did you try ALT+ENTER.. this should add a new line

Upvotes: 0

Related Questions