Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2008 Auto Generate Change Scripts Legacy Problem

We enable "Tools ==> Options ==> Designers ==> Table and Database Designers ==> Auto Generate Change Scripts" in our SQL Server Management Studio (SSMS). When changing our database schema, we save the script and, thanks to DB migration tools we've got installed on all the machines running our applications, we can synchronize the schema during the next software version update.

We recently switched our development copies and some production servers to SQL Server 2008. However, we still do have a few dozen SQL Server 2005 running our software in the wild. We're not planning on upgrading these for a little while.

The problem is simple. The scripts generated by SSMS simply don't always work with SQL Server 2005. SMSS is adding extra metadata to the commands (concerning lock escalation, for example). To make our scripts with 2005, we have to manually remove the extra information, otherwise the scripts don't run.

Is there any way to configure SSMS to generate scripts that are compatible with SQL Server 2005? Are there tools around that would get rid of the extra SQL automatically or at least let us know which files are problematic?

like image 920
Jason Kealey Avatar asked Jan 09 '09 17:01

Jason Kealey


2 Answers

In SQL Server management studio 2008 goto Tools -> Options -> SQL Server Object Explorer -> Scripting and Select "Script for server version" and change it to SQL Server 2005.

like image 168
Mitch Wheat Avatar answered Oct 23 '22 04:10

Mitch Wheat


The recommended solution to change the options appears to be corerct however it still generates ALTER TABLE SET (LOCK_ESCALATION = TABLE) on my database (I even put in compatibility mode 90)

like image 27
Justin King Avatar answered Oct 23 '22 03:10

Justin King