1

I generate script of my database (types of data to script = schema and data) from SQL Server 2008 R2 and run this script in SQL Server 2005, it shows me these errors:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '100'.

Msg 102, Level 15, State 6, Line 1
Incorrect syntax near 'HONOR_BROKER_PRIORITY'.

Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure 'sys.sp_db_vardecimal_storage_format'.

at State 1, Line 1

ALTER DATABASE [MYDATABASE] SET COMPATIBILITY_LEVEL = 100

at State 6, Line 1

ALTER DATABASE [MYDATABASE] SET HONOR_BROKER_PRIORITY OFF

at State 62, Line 1

EXEC sys.sp_db_vardecimal_storage_format N'MYDATABASE', N'ON' 

How can I fix this ?

1
  • I've also change COMPATIBILITY_LEVEL = 100 (version 2008) to COMPATIBILITY_LEVEL = 90 (version 2005) , but it doesn't work too . Commented Jul 3, 2013 at 4:19

1 Answer 1

2
ALTER DATABASE [MYDATABASE] SET COMPATIBILITY_LEVEL = 100

SQL Server 2005 doesn't have this command yet - new feature of SQL Server 2008.

You need to use this instead:

EXEC sp_dbcmptlevel AdventureWorks, 90;

Level 90 = SQL Server 2005 - that'll work; level 100 is SQL Server 2008 which will not work in SQL Server 2005 obviuosly.....

ALTER DATABASE [MYDATABASE] SET HONOR_BROKER_PRIORITY OFF
EXEC sys.sp_db_vardecimal_storage_format N'MYDATABASE', N'ON' 

Those are both new features in SQL Server 2008 or newer and don't have any equivalent in SQL Server 2005. The vardecimal storage format isn't supported (nor needed) in SQL Server 2005.

Sign up to request clarification or add additional context in comments.

2 Comments

@zey: well, since those features aren't present in SQL Server 2005 - yes, there's no other way, really. You should check out the Generate script wizard - it has a setting that allows you to define which version of SQL Server to generate the script for. Try to set that to 2005 and see what the result would be
Fortunately marc_s , it has Script for Server Version options which can change script version to 2005 :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.