Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 9th, 2008, 09:03 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default new line in data display in sp

when i used escape sequence characters in stored procedure, it display normal text on screen. like Dummy test. i need to display data return or show by sql in new line character e.g
Dummy
Test

when i used new line character '\n' it display text as it is.

I am using: Print 'Dummy \n Text'
output: Dummy \n Text
Desired result: Dummy
                Text



thanks......
__________________
thanks......
 
Old October 9th, 2008, 12:38 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Where are you trying to display this data? What is consuming it?

-Peter
compiledthoughts.com
 
Old October 9th, 2008, 02:23 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

\n is *NOT* anything special to T-SQL (SQL Server's dialect of SQL).

That is, the string '\n' is just the two characters \ and n.

\n means "newline" in C# and Java and JavaScript, etc., but *NOT* in T-SQL.

Instead of
     Print 'Dummy \n Text'
try
      Print 'Dummy ' + CHAR(10) + 'Text'
or even
      Print 'Dummy ' + CHAR(13) + CHAR(10) + 'Text'

http://msdn.microsoft.com/en-us/library/aa258239(SQL.80).aspx
 
Old October 9th, 2008, 07:22 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Dang, Pedant... nice to see someone who still remembers that "old" stuff like me. You even put the CrLf in the correct order so as not to accidently strike a character in the middle of a page on an old 110 baud Tele-Type. ;)

--Jeff Moden
 
Old October 9th, 2008, 09:22 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

No, no...you had to use CR+CR+LF on some of those machines. They would get worn out and dirty and were sluggish doing the RETURN so you needed a little extra time to be sure.

(Actually, I started out on model 35, which was even more bizarre. Had a removable font plate, so you could install different character sets.
http://portal.acm.org/citation.cfm?id=987461.987466
is one example. Our use was more exotic.)
 
Old October 10th, 2008, 05:57 AM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Heh... I remember that having to double up like that. Fun times...

--Jeff Moden





Similar Threads
Thread Thread Starter Forum Replies Last Post
display a line of text + image on front page nakori BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 June 9th, 2008 05:12 PM
Display 2 fields as one line in the combobox osemollie VB Databases Basics 2 May 17th, 2006 10:22 AM
How to plot data from an array in a line chart ! Alseikhan Excel VBA 0 January 27th, 2006 12:22 PM
exec sp within another sp collie SQL Server 2000 1 December 22nd, 2004 05:46 AM
Can a SP run another SP as sa? dbradley SQL Server 2000 0 July 17th, 2003 08:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.