Friday, May 6, 2011

DB2 sp_rename equivalent

Is there a DB2 v9.1 equivalent for sp_rename?

From stackoverflow
  • It depends on the object.

    For tables and indexes, you can use the RENAME sql statement.

    If you want to rename a column, you can use ALTER TABLE ... RENAME COLUMN.

    For other objects, you probably have to drop and recreate it.

    Hope that helps.

    Rashmi Pandit : can i rename an sp or do i have to do a drop - create??
    Michael Sharek : You have to do drop/create...alter procedure doesn't allow rename. http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.admin.doc/doc/r0008168.htm
    Rashmi Pandit : Thanks Michael. I guess sp_rename in SQLServer would internally do the same. Drop and recreate.

0 comments:

Post a Comment