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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 generatre create scripts for predefined queries

Author  Topic 

scabral7
Yak Posting Veteran

57 Posts

Posted - 2010-05-13 : 09:35:05
Hi,

I have about 800 stored procedures in my sql 2000 database. I want to move about 350 of them over to a new SQL 2005 database.

I know you can right click on the stored proc and say generate sql script, however i didn't want to have to sift through and manually pick out the 350 procs that i need.

i have the 350 proc names stored in a table. I was wondering if there was a way using script to use that table with the proc names and generate the create scripts that way. i would also need to script out the permssions for each proc.

Any ideas?

Kristen
Test

22859 Posts

Posted - 2010-05-13 : 09:47:22
Can't think of one, sorry.

FWIW we store all Sproc source code in files (one per object). They are stored in a revision control system, and it makes it much easier to solve questions like the one you are asking - rather than updating code directly in database and then trying to synchronise it to make update-version, or extract code for specific modules etc. (we use one sub-directory per module for example)

No help with where you are now, sorry about that, but maybe something to consider.

You'll probably tell me know that you normally work like that but this is some 3rd party database that you've been given to sort out?!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-13 : 09:51:10
You may need to play with this and let mw know if it helps
http://beyondrelational.com/blogs/madhivanan/archive/2009/10/26/script-out-procedures-to-seperate-files.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-13 : 10:29:52
Ah ... does SSMS still allow script-each-object-to-separate-file?

If so you could script all objects like that, and then use a Batch File (constructed from your table of required names) to MOVE the relevant flies to a different folder - then use them for your script.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-13 : 10:37:06
<<
Ah ... does SSMS still allow script-each-object-to-separate-file?
>>

Yes. It allows. There is an option file per object

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -