Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

SQLStudies

My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.

Change in SQL 2012 SSMS grid output behavior

It’s one of those things that always aggravated me but not really enough to complain about. When you run a query to grid in SSMS then copy and paste the value to a query window it stripped the carriage return/line feed.

-- Setup code
CREATE TABLE GridTest (String varchar(50))
GO

INSERT INTO GridTest VALUES ('Line
Broken
In
String'), 
('Line'+char(13)+'Broken'+char(13)+'With'+char(13)+'char(13)'),
('Line'+char(10)+'Broken'+char(10)+'With'+char(10)+'char(10)')
GO

Note that I’m testing with a string broken up by hitting enter, a string where I manually add char(13) and a string where I manually add char(10).

Run a SELECT * to a grid output.

Change in SQL 2012 SSMS grid output behavior

In SSMS 2008 R2 (and prior) when I copy the values and paste them into a query window (or notepad etc) and I get this:

Line  Broken  In  String
Line Broken With char(13)
Line Broken With char(10)

Not a big deal you might say, but when you are looking at sys.sql_modules or sys.dm_exec_query_text and copy and paste out code for a stored procedure, a view or even a relatively simple query it can be very aggravating.

Well when I copy and paste out of SSMS for SQL 2012 I get this.

Line
Broken
In
String
Line
Broken
With
char(13)
Line
Broken
With
char(10)

Woo hoo! All three of them display the carriage returns and line feeds. It may be a minor change but you have no idea how much I appreciate it. I should probably note that when I tried it by adding a CHAR(13) and a CHAR(10) I got the following (which is also rather aggravating but over all I think I’m still happier).

Line

Broken

With

char(13)

and

char(10)

Filed under: Microsoft SQL Server, SQLServerPedia Syndication, SSMS Tagged: microsoft sql server, SSMS

Comments

Leave a comment on the original post [sqlstudies.com, opens in a new window]

Loading comments...