At the moment I have a SQL Project ready to be deployed (Its like-for-like with the prod version).
However, when generating the deployment script – objects such as the stored procedures are coming up first in the deployment scripts; therefore the script is failing as the dependent objects (tables, functions etc…) have not been created yet.
How can I tell the visual studio project to script all dependencies first?
Advertisement
Answer
After trial and error; I have found an answer.
It turns out that it was due to square brackets.
For example: In the table definition it was using square brackets in the schema and object – [dbo].[tbl_Feedback]
Then in some stored procedures the same table was being referenced without the square brackets. dbo.tbl_Feedback
Once all the objects had been aligned (in this case added the missing square brackets) the deployment scripts were generated in the correct order. Creating parent objects first then its dependencies later.
Hope this helps others in the future!