Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto-generated script gives errors

Status
Not open for further replies.

sgk17

Technical User
Nov 8, 2002
68
US
I have a database that I want to re-create on another machine. I went to Enterprise Manager, right-clicked on the database, did a generate sql script and selected to script all objects. On the formatting tab I selected all the options except the one about only scripting 7.0 compatible features. I also selected everything on the options tab. Then I generated the script. I ran it from Query Analyzer on the other machine and it gave me errors. There were about 4 or 5 that said that no rows could be added to the sysdepends table because some stored procedures couldn't be found. What's going on? I'm using SQL Server 2000. Won't it generate the script in such a way that it won't produce errors when the script is run?
 
Are you just after the schema or do you want the data too?

If your intent is to have the data also, I would suggest either creating a backup of the DB and restoring it to your target server or as another option, if possible, detach the DB on the source server, copy the MDF/LDF of that DB to your target server and re-attach the source DB and attach the target DB.

You may also want to try DTS as a means to create the DB on your target server.

Thanks

J. Kusch
 
I just want the schema. I've found that if I break apart the script file and run the pieces in the correct order, it works. What was happening is that the script was trying to make use of objects that weren't defined until the end of the script. I think it's pretty stupid. It should generate the script in such a way that everything gets generated in the correct order.
 
I have run into that very same issue. And YES ... I agree totally with your comment stating that the order objects are created needs to be looked at a bit better by MS.

Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top