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
 how to store the character value in a attribute ?

Author  Topic 

kkumar
Starting Member

2 Posts

Posted - 2008-07-07 : 02:06:36
Hi,

I am trying to set the value of some attribute in a table, but it is storing the ascii value, not the character itself.

e.g.

select ascii(flag) from mytable;

ASCII(flag)
_______________
1

update mytable set flag='0';

it shows
select ascii(flag) from mytable;

ASCII(flag)
_______________
48
Note:flag is of type CHAR(1)


Kindly suggest how can I store the actual character in the attribute rather than its ascii value.

Regards,
Kuldeep

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-07-07 : 02:13:07
select flag from mytable instead of select ascii(flag) from mytable will bring '0' instead of 48.

Greetings
Webfred

There are 10 types of people in the world: Those who understand binary, and those who don't...
Go to Top of Page

kkumar
Starting Member

2 Posts

Posted - 2008-07-07 : 02:31:26
Thanks webfred!!

But why it store the ascii value when i do instead of charcter itself :
update mytable set='0';


quote:
Originally posted by webfred

select flag from mytable instead of select ascii(flag) from mytable will bring '0' instead of 48.

Greetings
Webfred

There are 10 types of people in the world: Those who understand binary, and those who don't...



Regards,
Kuldeep
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-07-07 : 02:41:34
I'm sorry, but i cannot understand the problem.
Maybe someone else in this forum can help?

Greetings
Webfred

There are 10 types of people in the world: Those who understand binary, and those who don't...
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2008-07-07 : 03:13:24
it's not storing the ascii value. You are selecting the ascii value when you use the ascii() funtion.
Go to Top of Page
   

- Advertisement -