Re: Total Replacing Hi
The easiest way to do this is probably easiest to do using a CURSOR and EXEC
a call to sp_rename.
See Books Online for more information regarding cursors.
Using the INFORMATION_SCHEMA.COLUMNS view should help cut down the need to
link multiple system tables.
John
"Dmitri Shvetsov" <dshvetsov@cox.net> wrote in message
news:UgEnb.94948$Ms2.65755@fed1read03...
> Hi,
>
> Is it possible to do from one script? We have a set of user's tables like
> "tbl%". We can get this list very easy using this script:
>
> SELECT name FROM sysobjects WHERE xtype = 'U' AND name LIKE 'tbl%' ORDER
BY
> name;
>
> We need to change some column names if these names are in a special list
> that we have. What can we do? Use FOR EACH ROW? Or what?
>
> So, I need to get a column list for each table and check if every column
> name is equal to one of the names from the list and then if YES replace it
> by something or add some symbol to this name. Terrible or possible?
>
> Regards,
> Dmitri
>
> |