15

What is the best way to use SQL Server 2008 as a development database, but ensure that the database is compatible with SQL Server 2005?

4

3 回答 3

19

This can be done via SQL Enterprise Manager or like this:

ALTER DATABASE <database> 
SET COMPATIBILITY_LEVEL = { 80 | 90 | 100 }

Use 90 for 2005 compatibility.

This replaces the functionality used for previous releases, the stored procedure sp_dbcmptlevel.

于 2008-08-11T05:35:06.177 回答
5

You can set the database compatibility level, but there is no guarantee that this will cover all your bases. For example the new data types will be available on the SQL 2008 system, but they won't be available on the SQL 2005 server.

The only way to guarantee that everything will work from Dev to Prod is to put SQL 2005 in development.

于 2008-09-02T09:42:18.180 回答
0

Don't forget that there are also behavioral differences between the two versions, and something on 2008 may perform differently (and insufficiently) than 2005 all other things equal - this will obviously depend on a lot of factors about your data and application.

You're better off developing against the lowest common denominator and testing against the newer versions.

于 2008-09-23T16:12:41.223 回答