sql server - Sql script generated by management studio gives errors when run as query -
I have a large database I found the script of my database schema using SQL Server Management Studio.
There are 176,000 lines in the script when I copied the script into a new query window and executed it.
1 'GO' = & gt; The wrong syntax error error is repeated next to 90% error lines. The scalar variable "@abc" must be declared. 3. The variable name 'sql' has already been declared, the variable name must be unique within a query batch or stored procedure. 4. Foreign Key 'FK_FAVOURITES_DETAIL_FAVOURITES' Reference Invalid Table 'dbo.FAVORITES' 5. Object "dbo.LIC_INFO" can not be found because it does not exist or you do not have permission According to the database, there could be no process of syntax error in invalid objects / relations or its definition
whether the management studio is limited in its ability to generate special scripts long Is correct or can run against a specific length of query batch or for specific script (such as), against dynamic SQL processes or user-defined datatypes
or in the process I do Can there be something wrong? SQL Server Management Studio (SSMS) is not good at creating scripts, in particular it does not work too much. Good work to determine the order in which objects should be prepared for preparing endencies. As soon as you have an error, the chance of next errors increases dramatically.
Regarding your expectation, "There may not be any syntax error in the database / invalidity or its definition in the database" This is not correct. Many objects present in the database may be present.
Depending on how you can create your script, you can review the Tools menu, Options, SQL Server Object Explorer, Scripting and Settings there.
Rhys
Comments
Post a Comment