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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 newline in sql output

Author  Topic 

Swati Jain
Posting Yak Master

139 Posts

Posted - 2009-05-05 : 09:58:51
hi All

Hi

I have query like

select 'History :'+History +'Complaint :'+Complaint as Summary
from tlb

i want output as
Summary
History:
--Some long text
Compaint:
-Some long text

but i am getting output in single line
as History:--Some long text Compaint:-Some long text

how i should correct this? pls help me asap

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-05-05 : 10:06:16
These kind of issues are meant to be handled in front end.

try this anyhow...

select 'History :'+History +char(13) +'Complaint :'+Complaint  
from tlb
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-05-05 : 10:14:14
Also you need to set result mode to Text

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-05-05 : 11:34:29
CHAR(13) should work fine, but I've seen some strnage behavior in the past unless I used CR + LF: CHAR(13) + CHAR(10). FYI..
Go to Top of Page
   

- Advertisement -