rename all column

  • hi

    Rename all the column name from bank_account to current_account IN bank database in all the object like view,table,porcedure etc... where every it occurs

    thanxs

  • hi

    can i Rename all the column name from bank_account to current_account IN bank database in all the object like view,table,porcedure etc... where every it occurs in the bank database

    thanxs

  • You can use a stored proc to do it:

    sp_rename [ @objname = ] 'object_name' ,

    [ @newname = ] 'new_name'

    [ , [ @objtype = ] 'object_type' ]

    You can get a list of columns by looking at the system tables, for example:

    select c.name as [column],o.name as

    ,o.type from syscolumns c join sysobjects o on (c.id=o.id)

    where (o.type in ('U','V') OR (o.type in ('TF', 'IF') and c.number = 0))

    order by o.name,c.type,c.name

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

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