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 2000 Forums
 Transact-SQL (2000)
 SPROC returns spaces instead of Char(10)

Author  Topic 

sbushway
Starting Member

18 Posts

Posted - 2005-06-15 : 11:22:15
I asked an earlier question about how to replace characters in a field in a SPROC ... that answered question, but I'm running into something that doesn't make much sense to me:

Here's the query in my SPROC (I have to store carriage-return line-feeds as two right square brackets in the database, but I don't want the brackets to display to the user - I want to convert the brackets back to the CRLF when I'm outputting the data):

SELECT DateChanged, Comments=Replace(Comments, ']]', Char(13)+Char(10))
FROM AddressChangeLog


Instead of printing out the CRLF (like I assumed it would), it's just outputting two spaces.

For instance, I input the data like this:
1
2
3


In the database, it's stored as
1 ]]2 ]]3

When I try to display it in my program from the database, it looks like
1   2   3


Can someone tell me what I'm doing wrong?

Thanks in advance,
Suzanne

X002548
Not Just a Number

15586 Posts

Posted - 2005-06-15 : 11:31:26
What's that Query look like in Query Analyzer?

Why would you care to mess arounf with CRLF in the db anyway?

What's the front end application?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

sbushway
Starting Member

18 Posts

Posted - 2005-06-15 : 11:40:31
In Query Analyzer, it looks the same as the output in my program: "1 2 3"

All of this is in a VB.NET web app - I'm using the result from this SPROC as the datasource to my datagrid. I'm sure there's a way (I just don't know it right now) to change ']]' into CRLF in my program, but I was just hoping there'd be a way in SQL to do it ...
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2005-06-16 : 07:26:31
The problem here is, you are trying to affect the DISPLAY while inside the DB. Let your web app handle DISPLAY.

*need more coffee*
SELECT * FROM Users WHERE CLUE > 0
(0 row(s) affected)
Go to Top of Page
   

- Advertisement -