Results 1 to 2 of 2

Thread: case sensitive in MS SQL

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613

    case sensitive in MS SQL

    I have a table (USERINFO) in MSSQL database with 2 columns: USR, PWD

    Let say I have 1 record: ABC, ****

    Now when I perform these:
    Select * from USERINFO where USR = "ABC"
    Select * from USERINFO where USR = "aBc"
    .....
    I always get 1 record. How do I compare the string case sensitive so that only

    Select * from USERINFO where USR = "ABC"

    will return 1 record.

    Thanks.

  2. #2
    Fanatic Member vb_dba's Avatar
    Join Date
    Jun 2001
    Location
    Somewhere aloft between the real world and insanity
    Posts
    1,016
    You can change the sort order on the server, which will allow you to perform this type of comparison. The only problem is that all of your data and database objects will be case sensitive. In otherwords, if you have a table named Customers, then Select * from customers will fail, as will Select * From CUSTOMERS. If you want to proceed with this, I got these instructions from Books Online on how to change the sort order:

    Follow these steps to rebuild the databases and maintain their contents.

    Back up the definitions of objects you want to preserve.
    Use SQL Server Enterprise Manager to create scripts for all of the objects in the user databases and master database.

    Export data from the user tables.
    Use Microsoft Data Transformation Services (DTS) or the bcp bulk copy utility to unload the user data.

    Rebuild the master database.
    Run the Rebuildm.exe command prompt utility. You can select new character set, sort order, and Unicode values and rebuild the master database with these new settings.

    Create new user databases.
    Use SQL Server Enterprise Manager or the CREATE DATABASE statement to re-create the user databases.

    Create objects using the scripts created earlier.
    Use SQL Server Query Analyzer to run the scripts you created earlier.

    Import data into the user tables.
    Use DTS or BCP to load data back into the user tables.
    Chris
    Chris

    Master Of My Domain
    Got A Question? Look Here First

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width