Pages

Saturday, September 4, 2010

Insert line breaks in SQL text data

Think, you want to insert text data into SQL server database as seperate lines. The answer is very simple. You can use following sql query...

INSERT INTO tableName(colunmName1, columnName2, ....)
VALUES ('Text Line One'  + char(13) + char(10) +  'Text Line Two', columnName2 Value so on...)

Then the text data stored as two lines in the database.

Text Line One
Text Line Two

If you need to break two lines then you can use  + char(13) + char(10) + char(13) + char(10) +
insted of  + char(13) + char(10) +
It'll be return

Text Line One


Text Line Two

0 comments: