Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kev510
Starting Member
5 Posts |
Posted - 2006-12-15 : 09:54:07
|
| Hi guys,I am trying to copy about 300 queries from one server to anotherthe problem is that I have queries that call for other queries, such as -->qry_1 calls for qry_2but if the script tries to create qry_1 without creating qry_2, then it causes an error saying qry_2 is not found.How would I make it so that I won't have to organize all 300 queries inside the script?Thanks for your help and time!-Kev |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-12-15 : 10:41:06
|
| Did you get the script for creating the views by generating it in Enterprise Manager or Management Studio? If not you should do so because they will create everything in the right order (you need at least SP1 on 2000 for this to be correct).If you don't want to generate the script, you could put a GO statement between each CREATE VIEW and then just run the script multiple times, each time it will create some of the views until they are all created. It's messy, but it works. |
 |
|
|
kev510
Starting Member
5 Posts |
Posted - 2006-12-15 : 13:11:18
|
| hello snSQL, thanks for your response!I used enterprise manager to automatically create the .sql script.So you do you mean I can just execute the script with errors, multiple times to create all the queries?How do I check if i have SP1 on 2000? Will having SP1 on 2000 create queries in the right order for the script to run smoothly?Please let me know. Thanks!-Kev |
 |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-12-15 : 15:44:40
|
| To see what service pack you have SELECT @@versionSP1 fixed a problem with the order in which dependent objects were scripted (http://support.microsoft.com/kb/289551)As long as there are GO statements between the various CREATE statements running the script multiple times will create all the first level views the first time round, then the second time round there will be errors creating the first level views, but they will be ignored and the second level views will be created and so on.Make sure that you do not execute any code that drops existing objects first or you'll just keep dropping and recreating the first level views. |
 |
|
|
|
|
|