SSMS Generate Scripts

JamesProsser 21 Reputation points
2022-08-10T11:49:35.167+00:00

I'm trying to generate a script of my database in order to recreate elsewhere. Using the script generated by SSMS/Generate Scripts, I receive lots of dependency errors / warnings i.e. although an object is created, I get a warning saying that it's dependent on another object and won't work until that object has been created. Why are the objects not created in order of dependency ? I have tried using a number of version of SSMS 18.10 onwards but there's no difference.

Thanks,
J

SQL Server | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. LuckyA 1 Reputation point
    2022-08-11T02:45:45.357+00:00

    Hi @JamesProsser ,

    In SSMS, go to Tools->Options->SQL Server Object Explorer->Scripting. In the section Object scipting options, check Generate script for dependent objects. Then in the scripting context menu, select DROP and CREATE TO. (Only CREATE TO does not seem to honour this option.)

    Refer to this similar thread to get another solution.


    If the answer is helpful, please click "Accept Answer" .

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.