Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Venugopal Saride,
Step 1: Run the script in Part 1 and identify the column data type and size of the column and the column property (NULL / NOT NULL) and number of columns to be changed.
Step 2: Select the target database and run Part 2, which will generate the script required.
Step 3: Copy the script and execute on the target database and change the column size.
This script can be used for char,nchar,varchar,nvarchar to any size including MAX column length (Refer to Part 3)
One of the use case I can think of this script is changing company name. Due to recent acquisitions, we have to keep changing the company name. Ex:- Company column in the HR / Finance / Revenue / DW databases is declared as varchar(10) / char(8) as you know your company name, now that you have to update your company to the new company which has more charcters then 10 then this script will be handy :).
For me it used to update my jdbc URL column length as we want to add the failover string to the actual jdbc url through out our configuration tables.
email me incase you need more information: email@example.com
Change company name in SQL Server 2005
This script changes the collation of columns to default database collation in all the tables
Script to change auto growth settings for all databases in SQL Server.
SSIS Script Task for Changing column values
This query generate add/alter script for missing or different columns. Execute on source database an...