'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.



Solution 1:[1]

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.

Solution 2:[2]

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

Solution 3:[3]

Each character has a Unicode that unique it from others, Indian Rupees Symbol has it own. so as every other characters you can insert it in yourdatabase, but the most important point is that your currencysymbol field in table should be NVARCHAR

When you are inserting this symbol you have to use its Unicode code like

 INSERT INTO Currency ([currencysymbol]) VALUES (N'?'); -- dont forget to use **N** before the symbol

just make sure that 20B9 is the code for your character

Solution 4:[4]

@Sanju Its so simple as to insert normal text, first of all you need to download a font from http://cdn.webrupee.com/WebRupee.V2.0.ttf. Than keep this font file in a folder named 'WebRupee' ok! than copy this code or write your own code as i deed, see

<form method="post" action="">
<table><style>
@font-face{font-family: 'WebRupee';
src: url('WebRupee/WebRupee.V2.0.ttf') format('truetype');font-weight: normal;font-style: normal;}
.WebRupee{
color:#FF0000;
font-family: 'WebRupee';}
</style>
   <tr>

      <td><input type="text" name="rs"  value="Rs."class="WebRupee"  /></span>
                 </td>
                     </tr>
                     <tr>

      <td><input type="submit" name="submit" value="submit" />
                 </td>
                     </tr>
                       </table>
</form>

<?php 
if($_POST['submit']){

  $sql="insert into rs(inr)VALUES('$_POST[rs]')";
  if(!mysql_query($sql,$con))
  {
      die('Error:'.mysql_error());
   }
        else{
       echo "<script>alert('One Record Added !!!...')</script>";

        mysql_close($con);
        }}

         ?>

Hope it will help you.

Solution 5:[5]

insert into  currency values('india','rupee',N'??'')

Solution 6:[6]

We have used nvarchar colum for currencysymbol and insert NCHAR(8377) :

insert into Currency (currencyName, currencysymbol)
values ('Indian Rupee', NCHAR(8377) );

Solution 7:[7]

SELECT Faculty_First_Name, Faculty_Salary, FORMAT(Faculty_Salary, 'C') AS DollarCurrency_Salary, CONCAT_WS(N'?','', Faculty_Salary) AS IndianRupee FROM Faculty_Info;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bobince
Solution 2
Solution 3 Nasser Hadjloo
Solution 4 mukesh kumar
Solution 5 Prahalad Gaggar
Solution 6 Cirdrix
Solution 7 Manohar K.G.