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 8709953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:30:01+00:00 2026-06-13T04:30:01+00:00

I have a table where one column may contain data which includes extended ASCII

  • 0

I have a table where one column may contain data which includes extended
ASCII characters (like ♥,♦,♣....)

When I search for the same using select query the result set doesn’t fetch exactly
for ex:

create table testasci(id int,name varchar(20))

insert into testasci values(1, 'santosh');
insert into testasci values(2, 'santosh♥');
insert into testasci values(3, 'santosh♦');
insert into testasci values(4, 'santosh2');
insert into testasci values(5, 'santoshσ');
insert into testasci values(6, 'santosh3');

When I search for any name with extended ASCII character like the following

select * from testasci where name = 'santosh♥'

result set displays id2, id3.

That too with question mark (?) symbol instead of the original character.

Any help? My result set should display only id2 for the above search query

  • 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-13T04:30:02+00:00Added an answer on June 13, 2026 at 4:30 am

    The problem is that the characters you are entering are NOT in the ASCII range at all. VARCHAR(20) is the wrong column datatype for your data.

    1. Change your table structure
    2. Change the way you insert
    3. Finally, change the way you SELECT

    Fixed:

    create table testasci(id int,name nvarchar(20))
    
    insert into testasci values(1,N'santosh');
    insert into testasci values(2,N'santosh♥');
    insert into testasci values(3,N'santosh♦');
    insert into testasci values(4,N'santosh2');
    insert into testasci values(5,N'santoshσ');
    insert into testasci values(6,N'santosh3');
    
    select * from testasci where name like N'santosh♥';
    

    Looking at your original definition of varchar(20), I have created an SQLFiddle to show the problem.

    select id, a.name, number, ascii(substring(a.name,number,1))
    from testasci a
    join master..spt_values v
      on v.number between 1 and len(a.name) and type='P'
    where a.id in (2,3)
    order by id, number
    

    You’ll notice that the 8th position of each of ID 2 and 3 contain the ASCII character (63), which is the literal question mark (?), not your special Unicode character. So you have lost it as soon as it hit the table column.

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

Sidebar

Related Questions

I have multiple columns in a table One column may contain the name of
In one of my tables I have a column named `dl_id` which may contain
I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work
i have a large mysql database table in which one column contains values ranging
I have a database table named 'student' in which there is one column named
I have a table in Oracle where one of the column contains UserIds which
i have table contain two column id and word . word column may contain
I have a column in a table that contains data like: column: col_name row
I'd like to add a new column to my data.table, which contains data from
I have a table with one column and four rows. Each tr has 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.