I have a huge database. I got script of my database schema using sql server management studio.
Script contains 176,000 lines. When I copied script to new query window and executed it. It says
1. Incorrect syntax near 'GO' => This error repeats after 90% of error lines
2. Must declare the scalar variable "@abc"
3. The variable name '@sql' has already been declared. Variable names must
be unique within a query batch or stored procedure
4. Foreign key 'FK_FAVOURITES_DETAIL_FAVOURITES' references invalid table
'dbo.FAVOURITES'
5. Cannot find the object "dbo.LIC_INFO" because it does not exist or you
do not have permissions
According to my expectation database could not have existed with invalid objects/relations or a procedure having synntax error in its definition
Is management studio limited in capability to generate a particular length of script correctly or to run query batch of particular length or it can fail against particular script (e.g) dynamic sql in procedures or user defined datatypes
Or what could be something wrong with the process I followed?