Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:40:39+00:00 2026-06-04T15:40:39+00:00

I have one unicode column nvarchar in sql server database. I am storing numeric

  • 0

I have one unicode column nvarchar in sql server database.
I am storing numeric values in that column in my localized “Indian Language GUJARATI”.
How can i use aggregate functions like sum,avg on that nvarchar column.

Note : That nvarchar column contains unicode data in localized language.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:40:40+00:00Added an answer on June 4, 2026 at 3:40 pm

    I got following procedure in both sql server and .net.

    Convert English to Gujarati Unicode and
    Convert Gujarati Unicode to English numbers

    .net Code

    public static class global
    {
        public static string Translate(string source, string fromStr, string toStr)
        {
    
            string result = "";
            foreach (var sourceChar in source)
            {
                int pos = fromStr.IndexOf(sourceChar);
                if ((pos >= 0) && (pos < toStr.Length))
                {
                    result += toStr[pos];
                }
            }
    
            return result;
        }
    
        public static string ToGujDig(this object   source)
        {
            string fromStr = ".0123456789";
            string toStr = ".\u0AE6\u0AE7\u0AE8\u0AE9\u0AEA\u0AEB\u0AEC\u0AED\u0AEE\u0AEF\u0AF0";
    
            string result = "";
            string s = source.ToString();
    
            foreach (var sourceChar in s)
            {
                int pos = fromStr.IndexOf(sourceChar);
                if ((pos >= 0) && (pos < toStr.Length))
                {
                    result += toStr[pos];
                }
            }
    
            return result;
        }
    
        public static string ToEngDig(this string  source)
        {
            string fromStr =     ".\u0AE6\u0AE7\u0AE8\u0AE9\u0AEA\u0AEB\u0AEC\u0AED\u0AEE\u0AEF\u0AF0";
            string toStr = ".0123456789";
    
            string result = "";
            string s = source.ToString();
    
            foreach (var sourceChar in s)
            {
                int pos = fromStr.IndexOf(sourceChar);
                if ((pos >= 0) && (pos < toStr.Length))
                {
                    result += toStr[pos];
                }
            }
    
            return result;
        }
    }
    

    sql server code

    1. pass numeric value and get unicode value

      CREATE FUNCTION [dbo].[NumericToUnicode]
      (
            @String VARCHAR(50)
      )
      RETURNS NVARCHAR(50)
      
      BEGIN
      
      DECLARE @rString NVARCHAR(50) 
      set @rString= N''
      
      DECLARE @length INT 
      set @length = LEN(@String)
      
      DECLARE @position INT 
      set @position= 1
      
      WHILE @position <= @length
      BEGIN
      
            IF (ASCII(SUBSTRING(@String, @position, 1))) = 46
                  SET @rString = @rString + N'.'
            ELSE
                  SET @rString = @rString + NCHAR(ASCII(SUBSTRING(@String, @position, 1)) + 2742)
                  SET @position = @position + 1
      END
      
      RETURN @rString
      
      END
      
      -- Test it
      SELECT [dbo].[NumericToUnicode]('50.0')  or
      SELECT [dbo].[NumericToUnicode](50.12) 
      
    2. Pass unicode value and get Numeric value

      Create  FUNCTION [dbo].[UnicodeToNumeric]
      (
          @nString NVARCHAR(50)
      )
      RETURNS NUMERIC(12,2)
      BEGIN 
      
      DECLARE @rString NVARCHAR(50) 
      set @rString=''
      
      DECLARE @position INT 
      set @position=1
      
      WHILE @position <= LEN(@nString)
      BEGIN
          IF (UNICODE(SUBSTRING(@nString, @position, 1))) = 46
              SET @rString = @rString + CHAR(UNICODE(SUBSTRING(@nString, @position, 1)))
          ELSE
                      SET @rString = @rString + CHAR(UNICODE(SUBSTRING(@nString, @position, 1)) - 2742)
          SET @position = @position + 1
      
      END
      
      RETURN @rString
      END
      

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have one database, and it contains some columns. My requirement is that how
I have one field in Database with varchar field in which i am storing
have one time consuming step that flattens a bunch of files. basically i'd like
I have one table that has sales records and another table that has additional
I have one database table which contains 8 columns. One of the columns is
I have a small problem that I think should be easily handled by SQL
I have one file that is encoded in ANSI format (showing in Notepad++ as
The book I am reading says that SQL Server supports two kinds of character
I have a column in ntext which holds large unicode strings longer than 4000
In SQL one can write a query that searches for a name of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.