Hello everyone,
In SQL Server books online there is this following example:
B. Use CHAR to insert a control character
This example uses CHAR(13) to print name, address, and city information
on separate lines, when the results are returned in text.
USE Northwind
SELECT FirstName + ' ' + LastName, + CHAR(13) + Address,
+ CHAR(13) + City, + Region
FROM Employees
WHERE EmployeeID = 1
Here is the result set:
Nancy Davolio
507 - 20th Ave. E.
Apt. 2A
Seattle WA
But when you run the select statement above in query analyzer the output
does not match the output shown above. The char(13) does not work as a
carriage return. Any thoughts as to why? I am working on SQL 2000 sp3
on Windows 2000.
Thanks,
Raziq.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!"Raziq Shekha" <raziq_shekha@.anadarko.com> wrote in message
news:eOg32A0lEHA.324@.TK2MSFTNGP11.phx.gbl...
> But when you run the select statement above in query analyzer the output
> does not match the output shown above. The char(13) does not work as a
> carriage return. Any thoughts as to why? I am working on SQL 2000 sp3
> on Windows 2000.
Do you have results set to text mode or grid mode? You need to use text
mode to see line breaks. Also, Windows uses CR-LF, which is CHAR(13) +
CHAR(10), some other systems use only CR or LF.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment