2

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.
1
  • 1
    That specific error? No need to be concerned. The script created a stored procedure before another one that it relied upon existed. But as the script says, it did create it. As long as the other ones got created as well, it's fine. Commented Sep 9, 2016 at 15:51

1 Answer 1

2

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.

3
  • Thanks for the answer! Is it possible to set this dependency tree when generating the script? I took a look at the code and the CREATE stored procedures were out of order in the script hence the warning.
    – Raidenlee
    Commented Sep 10, 2016 at 13:48
  • You can't explicitly write to the table (writing to system tables can be done with hackery, but it tends to break things). You could rerun the scripts for the procs that showed the dependency errors, that will take care of it. Really this is a MS scripting bug, but they don't seem to care about fixing it.
    – Nic
    Commented Sep 12, 2016 at 15:55
  • 1
    This can also be a circular dependency (A -> B and B -> A). This cannot be fixed by the scripting .... or it is just the wrong order the objects are created. Considering that building a dependency tree for big databases can be very expensive, this issue is the lesser evil. Commented Sep 4, 2019 at 16:16

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.