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
 General SQL Server Forums
 New to SQL Server Programming
 some special characters problem

Author  Topic 

learntsql

524 Posts

Posted - 2010-01-06 : 06:19:14
Hi..
How to retrieve some special characters as those are stored in db
like &,< using.
when i try to read & its showing as &

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-06 : 06:27:22
sorry didnt get that. whats the datatype of field?
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-06 : 06:35:31
nvarchar(MAX)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-06 : 06:37:21
then it should have any problem. whats it displaying when you try to select column?
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-06 : 06:52:46
when i try to read "&" its showing as & followed by amp;
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-06 : 06:56:41
the try to print taking its ascii value
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-06 : 07:08:22
sorry i didnt get.
u mean & ascii value or what.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-06 : 07:11:25
does you field store them as a big string or does it just store character alone?
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-06 : 07:16:39
It is stored as part big string
eg: The Audit is done by Agarwal & Meebo.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-06 : 07:42:31
Are you retreiving the character to an XML variable?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-06 : 08:03:09
no,directly retrieving column in select statement.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-06 : 08:05:14
Only to be sure.
Where do you display the &-sign - in SSMS query window or somewhere else (HTML-Page)?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-06 : 08:08:03
I use stored procedure and binds it to Report.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-06 : 08:18:36
Is the problem also existent when displaying the result of your stored proc in SSMS?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-06 : 08:23:53
Yes even in SSMS.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-06 : 08:31:44
Maybe it is dislayed as it is stored in the table.
Try to see what happens if youre column is retrieved as follows:
replace(your_colum,'unwanted code here','&') as your_column


unwanted code= & plus amp;


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-06 : 23:54:42
Whne i retrieve that column directly its showing correct,but when i use this column in stored procedure its showing wrong text as above posts.
the same problem is for < and > symbols too.
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-07 : 00:09:57
quote:
Originally posted by Peso

Are you retreiving the character to an XML variable?



N 56°04'39.26"
E 12°55'05.63"




Sorry Peso.
In my Stored procedure to build this column i am using "STUFF" and "FOR XML PATH('')".
What would be the problem.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-07 : 01:12:42
Yes.
Try adding the "TYPE" declarative.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

learntsql

524 Posts

Posted - 2010-01-07 : 01:43:51
Thank you.
sorry i didnt get.
any sample code please.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-07 : 01:49:01
see last part here

http://bradsruminations.blogspot.com/2009/11/xml-paths-of-glory.html
Go to Top of Page
    Next Page

- Advertisement -