SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL Server 2k & Case Sensitivity

    Hey guys...

    Is MS SQL Server 2k case sensitive when searching an SQL query?

    Eg: If I do a:

    SELECT * from table_A where username = 'Smith'

    and

    SELECT * from table_A where username = 'smith'

    What would happen if a "smith" exists in the d/b?

  2. #2
    There can be only One.... joelwills's Avatar
    Join Date
    Jul 2000
    Location
    England
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, smith, Smith, SMITH, SmItH etc are all the same things.

    Not sure what you mean by the 2nd part? If 'Smith' and 'smith' exist in the database it would bring back both rows regardless of which variant of the word Smith you used.
    Life Goggles - The Entertaining Environment Blog
    http://www.lifegoggles.com

  3. #3
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks joelwills...

    For the 2nd part, I meant that if an entry "smith" was in the d/b, what would both my queries return? I assume they should both return the entry.

  4. #4
    There can be only One.... joelwills's Avatar
    Join Date
    Jul 2000
    Location
    England
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you're right. If smith was in the db, both your queries would return the same correct row.
    Life Goggles - The Entertaining Environment Blog
    http://www.lifegoggles.com

  5. #5
    \m/ R.I.P. Dimebag! \m/ JimBolla's Avatar
    Join Date
    Dec 2001
    Location
    erie, pa
    Posts
    1,130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To determine the case sensitivity of a server, execute the stored procedure sp_server_info, and then examine the contents of row 18. If the server has been installed with the case-insensitive setting, the option for sort_order will be set to nocase. You can run a stored procedure from the Query Analyzer.

    By default, it is case-insensitive, but this is something that can be changed during the SQL install.

  6. #6
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    great... thanks guys!


Bookmarks

Posting Permissions

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