Determine the case of a table name

  • CanuckBuck

    Hall of Fame

    Points: 3890

    Hi. I have database which has some tables which are from a commercial schema and some which have been added by our data architecture team. The names of the tables from the commercial schema are all upper case. The names of our own tables are mixed case. Is there any way to do a select from information_schema.tables which will give me only the mixed case tables?

  • Sergiy

    SSC Guru

    Points: 109703

    Compare TABLE_NAME to UPPER(TABLE_NAME) using a case sensitive collation.

    Check what is your database default collation and choose similar one, but case sensitive.

    It should be going like this:

    select * from information_schema.tables

    WHERE TABLE_NAME COLLATE SQL_Latin1_General_CP1_CS_AS = UPPER(TABLE_NAME) COLLATE SQL_Latin1_General_CP1_CS_AS

  • CanuckBuck

    Hall of Fame

    Points: 3890

    lol! That's totally it. It seemed so much more difficult when I was trying to solve it on my own. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply