Matching key question – resubmitted

25 pts.
Tags:
SQL Server
SQL Server tables
Hi, resubmitting because the first upload did not seem to work... Here is the problem I am trying to solve. I need to extract some information from a table, say Tab2, using a matching key from another table, say Tab1. Tab1 has two columns, Col1 and Col2. Col1 is digits (1, 2, 3...) Col2 has letters (AA, Aa, aA, aa, AB etc) I need to use Col2 to join to Tab2 and extract some data from Tab2, based on some criteria (like values of Col2). The problem is that SQL is not differentiating between upper case and lower case values in Col2. So, AA is treated the same as Aa. If I wanted to retrieve information for AA from Tab2, it gives me the information for AA, Aa, aA and aa. How do I solve this problem? Thanks to all who try to help.

Software/Hardware used:
SQL Server

Answer Wiki

Thanks. We'll let you know when a new response is added.

That is because of the collation in use.

One solution, could be to use the <a href=”http://msdn.microsoft.com/en-us/library/ms184391.aspx”>COLLATE clause</a>.

Here is a blog post with some examples:

<a href=”http://blog.sqlauthority.com/2007/04/30/case-sensitive-sql-query-search/”>SQL SERVER – Collate – Case Sensitive SQL Query Search</a>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Slowlearner
    Thank you for your response. I will try it.
    25 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following