views:

136

answers:

2

The Server Explorer built into Visual Studio is a nice way to connect to your database, view existing data, and edit data. Very useful for entering sample data into a database for testing and development purposes.

However, what if you have a "text" column and want to enter a long text field? For example, I have a text column in which I want to store a multi-line XML value. I'd like to be able to do multi-line editing from within the table data viewer.

I can't figure out how to do that? Does anyone know if it can be done, and if so, how?

+1  A: 

I don't think it's possible. Management Studio display multi-lines text as one string.

Dmitri Kouminov
A: 

I don't think the editor supports multi-line input or editing. However, you can enter multiple line data by creating a simple INSERT statement. For example:

CREATE TABLE TableA (
  id INT IDENTITY PRIMARY KEY,
  data VARCHAR(MAX)
)

INSERT INTO TableA (data) VALUES
('row 1
row 2
row 3')

Then, just select the entire INSERT statement and all of the data, and hit F5 to execute it.

Also, FWIW, the TEXT data type has been deprecated; VARCHAR(MAX) is the replacement (it's better for many reasons).

RickNZ