script out all procs from one db to another

  • i have two questions:

    i) i need to script out all store procs from one db to another..i know i can use DTS or SSIS package..but our package fails sometimes so just as a backup plan..i know i can also restore the db and get all store procs..but i guess dat is little lengthy..i copied the script from the db using "Generate Scripts" task...but when i try runninn as a job it gives me an error saying procs all ready exist...could anyone please give me a script do delete all existing procs so that i can refresh them with the new ones.

    ii)why do some databases have systems procs and some dont..

    thanks.

  • When you create the script institute another prior which will check for the existence of the procedure and drop it if it exists.

    All databases should have system objects, are the databases you are checking for these objects different in some manner than the others on the instance?



    Shamless self promotion - read my blog http://sirsql.net

  • When you Generate the Scripts, make sure the the "Include IF NOT EXISTS" option is set.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • thank you for the reply but i cant understant what you mean by in the first para..could you please explain me..thanks..

  • thanks...let me try once..

  • There is an option in SSMS to specify if you want to Include a DROP statement as well when scripting any object in the Database. What both of them who have given advice to you mean is to make sure you have this Option of Scripting Drop Statements turned ON.

    -Roy

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply