Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 auto updating stored procedures?

Author  Topic 

XSpidercideX
Starting Member

1 Post

Posted - 2007-04-12 : 02:35:18
Is it possible to get SQL Server to automatically update the table/field names in your stored procedures when changing those table/field names in the database?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-12 : 02:37:23
No. Not possible. Can't think of any other automated method also.

Best way is have your stored procedure script to file and use FIND & REPLACE to do it


KH

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-04-12 : 03:24:45
We mechanically generate all our CRUD procedures, that helps with name changes.

You might be able to use SYSDEPENDS to locate procedures that reference a particular object.

We use unique names for all columns in the database prefixing each column's name with a mnemonic that represents the table - so a CUSTOMER table might have columns cust_ID, cust_Name, cust_Address ... - that makes it easier to guarantee finding all instances of an object's name. We also use the column name for any temporary @variables referencing that column - so @cust_ID_Start and @cust_ID_End for variables used in a Stored Procedure for a report range. They get found too ...

We have each Sproc and Trigger in a separate text file (and in a version control system) and it is then easy to do a global find & replace.

Kristen
Go to Top of Page
   

- Advertisement -