From: oliver pandian on
I have to copy quite a few Stored procedures from a database. Is there a
quicker way I could do this? thx
From: John Bell on
On Thu, 20 May 2010 12:31:01 -0700, oliver pandian
<oliverpandian(a)discussions.microsoft.com> wrote:

>I have to copy quite a few Stored procedures from a database. Is there a
>quicker way I could do this? thx

You can script them in Management studio at the database level
(tasks/generate scripts) outputting the script to a query window ,
change any database references in three part names or the use
statement and then run the script. You may want to go into the
advanced options to script drop statements to make sure they don't
exist.

Of course if you had version control you would have already got the
scripts!

John
From: Bob Barrows on
oliver pandian wrote:
> I have to copy quite a few Stored procedures from a database. Is
> there a quicker way I could do this? thx

RedGate SQL Compare comes in quite handy for this type of situation.
If you're up-to-speed with SSIS, there's a Transfer SQL Server Objects
task you can use.
--
HTH,
Bob Barrows


From: sloan on

//> Of course if you had version control you would have already got the
> scripts!//

True Dat...


See:

http://odetocode.com/blogs/scott/archive/2008/01/30/three-rules-for-database-work.aspx
http://odetocode.com/blogs/scott/archive/2008/02/02/versioning-databases-views-stored-procedures-and-the-like.aspx

One File per Object

My strategy is to script every view, stored procedure, and function into a
separate file, then commit the files to source control. If someone needs to
add a new view, they script the view into a file and commit the file to
source control. If someone needs to modify a view, they modify the view's
script file and commit again. If you need to delete a view from the
database, delete the file from source control. It's a relatively simple
workflow.






"John Bell" <jbellnewsposts(a)hotmail.com> wrote in message
news:7q3bv593cct614q85ocjc7duh85q08iush(a)4ax.com...
> On Thu, 20 May 2010 12:31:01 -0700, oliver pandian
> <oliverpandian(a)discussions.microsoft.com> wrote:
>
>>I have to copy quite a few Stored procedures from a database. Is there a
>>quicker way I could do this? thx
>
> You can script them in Management studio at the database level
> (tasks/generate scripts) outputting the script to a query window ,
> change any database references in three part names or the use
> statement and then run the script. You may want to go into the
> advanced options to script drop statements to make sure they don't
> exist.
>
> Of course if you had version control you would have already got the
> scripts!
>
> John