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

  • SEARCH
  • Home
  • 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 8594603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:14:13+00:00 2026-06-12T00:14:13+00:00

A Query result is just Numbers and it would be easy to read thru

  • 0

A Query result is just Numbers and it would be easy to read thru and understand if they are String.
How to mark the String equivalent for a number in the query result.

The Mapping for Numbers vs String has to be in the Query.

select num from table;
Query Result is 9,2,4,7.
String literals are to be mapped to this numbers. the num range is from {0-9}
0-Prepaid, 1 -postpaid like wise

  • 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-12T00:14:14+00:00Added an answer on June 12, 2026 at 12:14 am

    You can use CASE expression for this like so:

    SELECT 
      ...
      CASE 
        WHEN 1 THEN 'Postpaid'
        WHEN 2 THEN 'prepaid'
        ...
       END
    ...
    

    You can do this also using a temp table for example:

    DECLARE @t Table(NumberToReplace INT, replacewith VARCHAR(50));
    INSERT INTO @t VALUES
    (1, 'Postpaid'),
    (2, 'Prepaid'),
    ...
    

    Then you can JOIN the two tables to replace the numbers with the corresponding string:

    SELECT 
      t1.Column1, t1.Column1, t2.replacewith
    FROM YourTable t1
    LEFT JOIN temp t2 ON t1.NumberToReplace = t2.NumberToReplace
    

    I used LEFT JOIN to give NULL values for the numbers that had no corresponding strings in the other table.

    Here is a demo in sQL fiddle

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

Sidebar

Related Questions

i am just getting the result from a query like this user_id 108 183
I would like to save query result into redis using JSON serialization and query
I would like to retrieve an ordered query result, but I need to have
How to return my LINQ query result as a particular object public CountryTable GetSelectedEventInfo(string
I would like to generate a table (or query result) in this form +---------------------+---------------------+
How would I return multiple values (say, a number and a string) from a
I have the following query where I would like to return two result sets.
Can't seem to get my query tweaked just right; any help would be appreciated.
I have this question, just in theory. I do some query results and there
How to save query result using T-SQL in a csv file in SSMS 2008?

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.