w0051977
w0051977

Reputation: 15817

SQL Server Management Studio ignoring carriage returns

Say I have an INSERT like this:

INSERT INTO Queries (query) 
values ('select * from person 
         where id = 1 
         and idtype=2')

I then perform a SELECT like this:

SELECT Query 
FROM Queries

However, the result in SQL Server Management Studio is like this:

select * from person where id = 1 and idtype=2

I want a result like this:

select * from person 
    where id = 1 
    and idtype=2

How do I achieve this? SQL Server Management Studio seems to ignore carriage returns.

I recall reading a question on here some time ago which suggested using XML Path. The queries column is a varchar(100).

Upvotes: 1

Views: 729

Answers (2)

robotik
robotik

Reputation: 2017

the carriage returns are there but they don't show in the grid results. try to copy and paste the results to a new query window or a text editor to check.

Upvotes: 0

rodrigogq
rodrigogq

Reputation: 1953

I use to insert texts in my columns with several carriage returns.

Do display this, try changing your query output as text instead of column. There should be a button in toolbox for that, but you can change it on Sql output options and preferences too.

Upvotes: 2

Related Questions