Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 849
  • Last Modified:

Copy SQL Stored Procedures (Export and Import)

We have a DB that got corrupted and had to be repaired (log file was deleted) - unfortunately it seems like not everything was recovered.
It's a CRM database and when we try to run the redeployment wizard it fails. When we look at the logs to see why it failed we see :

04/22/2009 07:54:17 The object 'p_CascadeGrantAccess' does not exist in database 'AcmeWidgits_MSCRM'.
04/22/2009 07:54:17 Microsoft OLE DB Provider for SQL Server

We do have a backup, but it's at least a month old! If we recover that SQL DB, is it possible to export the stored procedure (or procedures...) then go back to the more current DB and IMPORT the stored procedures?
0
spamster
Asked:
spamster
  • 2
  • 2
1 Solution
 
mvgeertruyenCommented:
It is - you can copy objects using the import/export wizard (amongst other ways of recreating them)
0
 
spamsterAuthor Commented:
Ok, do both Databases have to be up at the same time to do that?
Or could I export to a file?
Or do I have to create a blank DB and export the stored procedures into that, and then restore the more current DB and import them in?
0
 
mvgeertruyenCommented:
For the wizard both DB's need to be online and you need access to both. If they are not you can just copy and past the statements from the old DB; open the new one, paste in a query window and running them will create the procedure. Either way; there are numerous options to achieve what you want (you could perhaps restore the old DB under a different name on the same server; then run the wizard)
0
 
spamsterAuthor Commented:
Thanks man, I'm sure I can use this solution to get at least most of my data back :) Hope I can return the help that you gave some day.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now