Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert Indian Rupees Symbol in Database (Oracle 10g, MySql 5.0 and Sql Server 2008)?

How to insert Indian Rupees Symbol in Database (Oracle 10g, MySql 5.0 and Sql Server 2008)?

Actually i had one Table "Currency" , in which 2 field is like "currencyName" and "currencysymbol", so how would i insert new rupees symbol in databse.

like image 425
Sanju Avatar asked Oct 07 '10 07:10

Sanju


2 Answers

There's nothing special about (U+20B9 New Rupee symbol), except that, being so new, there is almost zero font support for it. If you've got a database connection that supports Unicode, you can store it just as easily as any other character:

INSERT INTO Currency (name, symbol) VALUES ('INR', '₹');

(You would want to use NVARCHAR for storage and N'₹' in SQL Server.)

If you haven't got a Unicode-safe connection (for example you're using some crap tool like the Windows console) you would have to work around that using eg.

VALUES ('INR', CHAR(226, 130, 185))

for a UTF-8-collated column in MySQL, or NCHAR(8377) for a Unicode column in SQL Server.

like image 126
bobince Avatar answered Oct 12 '22 23:10

bobince


Not ever done this but can use use NCHAR (integer_expression )

insert into Currency (currencyName, currencysymbol)
values ('Indian Rupee', NCHAR(8425) ) -- 8425 is 20B9 in decimal
like image 33
Preet Sangha Avatar answered Oct 12 '22 23:10

Preet Sangha