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
 Development Tools
 Other Development Tools
 Decimal NCR to characters

Author  Topic 

shajimanjeri
Posting Yak Master

179 Posts

Posted - 2007-07-11 : 11:40:35

I am receiving Decimal NCR from a query string, now how can I re-convert it into characters to insert into database?

Thanks in advance
Shaji

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-11 : 12:17:47
what is a decimal NCR?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

shajimanjeri
Posting Yak Master

179 Posts

Posted - 2007-07-11 : 12:30:14
Its some kind of decoding. For more please see
http://people.w3.org/rishida/scripts/uniview/conversion
or
http://www.w3.org/International/questions/qa-escapes

so how can i convert this decimal NCR to characters?
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-07-11 : 12:45:07
From their definition "All NCRs begin with # and end with ;". For decimal NCR's everything between is, perhaps the actual decimal value.
Try a REPLACE(REPLACE(column, '#', ''), ';', '') and then do a CONVERT(DEcimal, REPLACE(REPLACE(column, '#', ''), ';', '') )

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-12 : 04:38:55
shajimanjeri, maybe you shopuld give us some sample data and desired result for this?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-07-12 : 12:18:00
I think OP wants to do something like this:

input is a string like this: asdf

which represents the string 'asdf'

and you want to insert it like this then:

insert into mytable (mycolumn)
select nchar(97)+nchar(115)+nchar(100)+nchar(102)

yuck. if you are doing this kind of thing a lot, I would suggest doing the string parsing in a CLR udf perhaps. parsing strings is generally faster and easier in code.


elsasoft.org
Go to Top of Page
   

- Advertisement -