Column Names Case Sensitive

  • I have recently moved a sql2000 db to 2005.

    I have problem whereby my sql statements now throw errors because it cannot find certain column names in the tsql.

    I have found that the column names in my tsql statements must match their exact case as defined in the column name in the tables - where they werent before in 2000????

    I have literally hundreds of sql statements in many applications - which will need altering.

    What is the reason for this change - and is there a setting to stop this?

     

    Many thanks in advance....

     

  • Check if the server and database collation settings are case sensitive.  If they are you can change them back to case insensitive to completely solve the problem.

  • Thanks for that...

    Where do i find/change the collation setting for a database - cant find it anywhere in 2005?

     

    Many thanks again...

     

  • Not sure.  I'd check the database properties or the books online alter database.  But I don't have any 2005 installed here so I can't check for you.

  • select

    name, collation_name from master.sys.databases

    select

    object_name(id) tablename, collation_name from sys.columns

     

    MohammedU
    Microsoft SQL Server MVP

  • Thanks for that....

    Do you think if i detach then reattach this particular database the collation will then be set as per the master?

    As there are other databases in this instance of sql 2005 that dont have this problem?

    The database in question was a backed up from another server with sql 2005 on it?

     

  • What results did those 2 queries sent out?

  • For the databases that i dont have this problem with are set to: Latin1_General_CI_AS

    The one with the problem - its collation is NULL.

    I went into the properties of the database in question and reset the collation as per the the other ones - and it now seems to work fine.

    Thanks very much for your help....

  • Glad to hear that.

Viewing 9 posts - 1 through 8 (of 8 total)

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