One of the core fields present on several of my app’s major database tables needs to be changed from varchar(5) to varchar(8). The list of stored procedures that depend on these tables is extremely long, not to mention the changes that would have to be made in my Data Access Layer (ASP.NET 2.0 DataSet with TableAdapters).
Is there any way to automatically (and safely) change the Type of the all-important field and have the changes propagate to all the stored procedures / Data Access Layer calls that depend on it?
I’m using a SQL Server 2005 database.
You might be interested in this essay by Scott Ambler on Database Refactoring. I think he also has a book on it. The basic idea, I believe, will be to introduce a new column with the proper width, copy existing data to the new column, implement a trigger to synchronize any new inserts/updates, migrate your SP/DAL to use the new column, then remove the old column when you are completely done. All new code uses the new column, obviously. I don’t know of any automated way to do the updates to your SP/DAL, unfortunately.