Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Dinky
Starting Member
37 Posts |
Posted - 2008-04-23 : 15:10:19
|
| How to get a carriage return (or new line) in the result of select query.Example: Select 'a' + 'b'displayaband not ab |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-04-23 : 15:12:37
|
| SELECT 'a' + CHAR(10) + CHAR(13) + 'b'Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
Dinky
Starting Member
37 Posts |
Posted - 2008-04-23 : 17:05:12
|
| SELECT 'a' + CHAR(10) + CHAR(13) + 'b'does not work |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-04-23 : 17:09:03
|
| Yes it does. Perhaps you are viewing your data in the grid mode. To see the formatting, you need to display it in text.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
Dinky
Starting Member
37 Posts |
Posted - 2008-04-23 : 17:56:09
|
| I run it in SQL server 2005 management studio and then copy the results into notepad. It does not display a and b in 2 lines - just a b |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-04-23 : 18:03:21
|
| see results in text view. Go query-results to -text |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-04-23 : 18:13:50
|
quote: Originally posted by Dinky I run it in SQL server 2005 management studio and then copy the results into notepad. It does not display a and b in 2 lines - just a b
You must switch to text mode first. Once in text mode, you'll see the carriage return and can copy/paste into notepad to see it too.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-24 : 03:33:09
|
quote: Originally posted by sodeep see results in text view. Go query-results to -text
or Press CONTROL+TMadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-24 : 03:52:24
|
And if you don't want an empty line between A and B, switch order of CHAR(10) and CHAR(13)SELECT 'A' + CHAR(13) + CHAR(10) + 'B' E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|