SQL Server – Executing Generated DB Script in SQL 2008 R2

compatibility-levelscriptingsql-server-2008sql-server-2012stored-procedures

I generated a script (using the wizard from SSMS 2012) to produce a SQL 2008 R2 compatible database script. I ran this script in a SSMS 2008 R2 instance and i got a bunch (30) of these possibly "warning" errors:

The module 'spMoney_Increase' depends on the missing object
'dbo.spMoney_Decrease'. The module will still be created; however, it
cannot run successfully until the object exists.

Do i need to be concerned about these errors? Note that the errors did not break the overall execution and i know trying to put 2012 DB into a 2008 instance is not recommended but you know how client request goes…

——– Description of Process ——-

In SSMS 2012 – Server A

  • Right clicked on MY_DB > Tasks > Generate Scripts
  • In the Set Scripting Options > Advanced > I chose the below setup
    Advanced Scripting Options
  • Then Ok > Next > Finish

    In SSMS 2008 R2 – Server B

  • I created folder locations on the C drive that mimicked Server A so i didn't need to change the DIR paths in the script:

CREATE DATABASE [MY_DB] ON PRIMARY ( NAME = N'MY_DB', FILENAME =
N'C:\DBS\MY_DB.mdf' , SIZE = 16384KB , MAXSIZE = UNLIMITED, FILEGROWTH
= 1024KB )

LOG ON ( NAME = N'MY_DB_log', FILENAME = N'C:\DBS\MY_DB_log.ldf' ,
SIZE = 1280KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) GO

  • Executed the script and got the "warning" error above.

Best Answer

This is a warning message that comes up due to a missing dependency (it also means that the SQL dependency tree may not be correctly set, and so you won't have correct entries in sys.sql_expression_dependencies which can be useful down the road). This is just a warning however, and so long as the dependent object is created you will have no issues with running your code.

You can also repush the items you get warnings on, and that will fix the dependency list, but again, not critical.