July 25th, 2008

How to rename a column in Sybase ASE

Today I needed to rename a column in a Sybase ASE 12.5.1 database, and couldn’t seem to find the right syntax. My first few search results gave me syntax that was not actually relevant for my database. Two different pages led me to believe that some variation of this might work:

ALTER TABLE [table_name] RENAME [old_column_name] TO [new_column_name]

But that did not work for me. Upon closer inspection, I noticed that those two pages were for Sybase ASA, not ASE. I refined my search terms a bit, and found this:

sp_rename ‘[table_name].[old_column_name]’,'[new_column_name]’

Thanks to Rob Verschoor for posting this on dbforums.com!

One Response to “How to rename a column in Sybase ASE”

  1. Alan Mehio Says:

    Hi,
    I was using the “syscolumns” table to rename a column name since there was no way of doing it through Alter table statement in Sybase.
    Now I see the sp_rename is much better and safer approach

    Regards,
    Alan Mehio
    London,UK

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>