Changing Columns to Upper Case

  • Does anyone know a way to change all columns and table names to upper case?

  • I can think of a few of approaches here.   Someone else may be able to offer different input. 

    1. use the sp_rename procedure for the table name and the columns.  Good example in Books Online.
    2. Using the design tool in Enterprise Manager rename the column and table.
    3. With a little juggling of the data, create and populate a new table with the uppercase names.   Lots of dependencies to think about and research for this one.

    Regardless of how you do it keep in mind this may effect stored procs, keys, etc.

     


    "Keep Your Stick On the Ice" ..Red Green

  • Why do you need to do that??

  • SELECT LOUD_COLUMN1, LOUD_COLUMN2, LOUD_COLUMN3

    FROM LOUD_TABLE

    WHERE LOUD_COLUMN1 = "SOME LOUD DATA"

    Don't you think this is how code was written, say 20 years ago? And beside lower visual functionality, it's just plain ugly.

    PS: No offence intended, just my personal opinion.

  • The easier way is to run the update statement against syscolumns table.

    select 'update syscolumns set name = upper(name) where object_name(id) like ' + '''' + name + ''''

    from sysobjects

    where type='U'

    order by name

    go

Viewing 5 posts - 1 through 4 (of 4 total)

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