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.
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 advanceShaji |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-07-11 : 12:17:47
|
what is a decimal NCR?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
|
|
shajimanjeri
Posting Yak Master
179 Posts |
|
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/ |
|
|
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 1980blog: http://weblogs.sqlteam.com/mladenp |
|
|
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: asdfwhich 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 |
|
|
|
|
|
|
|