[dba-SQLServer]Changing a Column Name Globally

Arthur Fuller artful at rogers.com
Tue Oct 7 13:01:43 CDT 2003


I wrote something very similar using sysobjects and syscolumns and
syscomments, so the "find" part is trivial. The "replace" part is what
I'm hung up on. I want to be able to change the name of column AAA to
BBB and have every dependent object affected. Imagine 500 tables, 1000
views and 1000 sprocs; I want to change AAA to BBB and have everything
continue to work. An opium dream?

A.

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of
Francisco H Tapia
Sent: Monday, October 06, 2003 8:57 AM
To: dba-sqlserver at databaseadvisors.com
Subject: Re: [dba-SQLServer]Changing a Column Name Globally


Arthur Fuller wrote:

> Suppose I want to change a column name globally (i.e. in every table, 
> every sproc, every view and every UDF). Is there a concise way of 
> doing it? SalesID -> SaleNumber.
> 
> TIA,
> Arthur
> 

Don't know about Sprocs or UDF's but I have an old script from the days 
in SWYNK.com, it's called sp_ColumnHelp, it locates all the views/tables

that a specific column is available and if you add the additional 
paramter even gives back only those that match a specific value.

With some tweaking I'm sure you could adjust it to do what you want for 
the tables/views, but I'm not sure about sprocs and udfs.

I can send you the .sql attachment seperatly if you want it.

-- 
-Francisco


_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 9/1/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 9/1/2003
 




More information about the dba-SQLServer mailing list