This tutorial is designed for:
- MS SQL Server
- Visual Studio (for web or desktop)
- In SQL Server Management Studio (SSMS)
- Check for source and destination columns (for instance if widening "Address1" from 40 to 50, make sure all the columns in the order table, address book, Shipping and Billing etc are all the same)
- Update All Views that depend on this column. (SQL Server does not do this automatically)
- Update all stored procedures that operate on this column (for instance in and out parameters that access the changed column)
- In your Desktop App:
- Check all dataset xsd files to ensure the result column maxlengths are updated.
- Check all dataset xsd files to ensure the query parameter maxlengths are updated.
- Ensure all databound textboxes are set to the correct MaxLength.
- Ensure all DataGridView Columns are set to the correct MaxInputLength.
There is actually a stored procedure for updating views. Once you have found a dependent view, just run...
EXECUTE sp_refreshview 'dbo.v_myViewName';
That will take care of it. Of course if your view is no longer valid because of the change, you'll get an appropriately misleading error message from Microsoft.
Updating Stored Procs:
Your stored procs have a header much like this:
ALTER PROCEDURE [dbo].[StoredProcName]
-- Add the parameters for the stored procedure here
@customer varchar(10),
@PurchaseOrder varchar(15),
@Address1 varchar(40)
AS
These header parameters and any internally declared variables must be changed to match any column changes.
...
Bryan Valencia is a contributing editor and founder of Visual Studio Journey. He owns and operates Software Services, a web design and hosting company in Manteca, California.
No comments:
Post a Comment