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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:29:36+00:00 2026-06-13T06:29:36+00:00

I m in a situation where i need to compare two tables against Projectnumber.

  • 0

I m in a situation where i need to compare two tables against Projectnumber. Both tables has field ProjectNumber but one has datatype INT and other has VARCHAR(45). So when i try to run following query it result some un-matched records too

 Select prj.Projectnumber,ps.ProjectNumber as 'ProjectNumber2'
 from projectlistsearch ps 
 inner join project prj on ps.ProjectNumber= prj.ProjectNumber

This result some correct records but also result bad like this

ProjectNumber     ProjectNumber2
8                 08-809076
11                11-437881
11                11-505934
2007              2007-45750
2011              2011-0A76

I tried type casting as well but did not work.

How can i overcome this situation to get only completely matched record?

thanks

  • 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-13T06:29:37+00:00Added an answer on June 13, 2026 at 6:29 am

    I’d advise to convert the INT to VARCHAR and compare those two, because for example converting a VARCHAR to INT when the text begins with decimal numbers, only the parseable prefix part will be converted to int:

    Input:

    '08-809076'
    

    Parseable prefix:

    08
    

    Converted to INT

    8
    

    The other way round, the VARCHAR value '8' is compared against '08-809076' which will not match.

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

Sidebar

Related Questions

I am facing a situation and need help. I have two tables: user: user_id
I have run into a situation where I need to compare two different lists
Very often I encounter situation where I need to see or manually compare two
Did you ever have the following situation: you need to store information, but a
I am using EF to access Sql azure. In one situation I need to
I have a situation where I need to pass two parameters to an action.
I have two arrays each array has some values for instance: int a[] =
Here is my current situation: I have two tm structs, both set to the
I have a situation where I need to compare a char* with a WideString
i need to compare the size of 10 queues and determine the least one

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.