Show Rupee Symbol

Written by

We will see some of the methods to Show Rupee Symbol in SQL Server by using On-Premises DB and Azure SQL DB in SSMS ( SQL Server Management Studio ) and Azure Data Studio.

Methods to Show Rupee Symbol

  • Using FORMAT ( ) Function
  • Using NCHAR ( ) Function

SQL Script

DECLARE @Amount AS TABLE (Amount MONEY);
INSERT INTO @Amount
SELECT 1998 UNION ALL SELECT 19998;
 
SELECT Amount,
'INR ' + FORMAT(Amount,'C','en-in') AS 'FORMAT',
'INR ' + NCHAR(8377) + ' ' + CONVERT(VARCHAR(30),Amount,1) AS 'NCHAR'
FROM @Amount;

Image Pic in SSMS (On-Premises/Azure SQL DB)

Image Pic in SSMS

Image Pic in Azure Data Studio (Azure SQL DB)

Image Pic in Azure Data Studio

NOTE

The Unicode number – 8360 represents Generic Rupee whereas 8377 represents Indian Rupee. We can Check those if we try like below ( Using NCHAR ( ) Function )-

SQL Script

SELECT
    NCHAR(8360) AS 'Generic Rupee',
    NCHAR(8377) AS 'Indian Rupee';

Image Pic

Generic Rupee Vs Indian Rupee

The Difference between FORMAT and NCHAR Function methods, while using the above scripts are the Number of thousand separators.

SQL Script

DECLARE @Amount AS TABLE (Amount MONEY);
INSERT INTO @Amount
SELECT 199998;
 
SELECT Amount,
'INR ' + FORMAT(Amount,'C','en-in') AS 'FORMAT',
'INR ' + NCHAR(8377) + ' ' + CONVERT(VARCHAR(30),Amount,1) AS 'NCHAR'
FROM @Amount;

Image Pic

Number of thousand separators Difference

To View Data Type of Results

We can use Temporary Tables and View its Structure to easily know the Data Type of Result sets. Check here To View Structure of Temp Table

SQL Script

IF OBJECT_ID('TEMPDB..#TEMP') IS NOT NULL
    DROP TABLE #Temp;
 
DECLARE @Amount AS TABLE (Amount MONEY);
INSERT INTO @Amount
SELECT 1998 UNION ALL SELECT 19998;
 
SELECT Amount,
'INR ' + FORMAT(Amount,'C','en-in') AS 'FORMAT',
'INR ' + NCHAR(8377) + ' ' + CONVERT(VARCHAR(30),Amount,1) AS 'NCHAR'
INTO #Temp
FROM @Amount;
 
EXEC TEMPDB..SP_HELP #Temp;

Image Pic

To View Data Type of Results
Article Categories:
SQL Server

Leave a Reply

Your email address will not be published. Required fields are marked *

Shares