Wednesday, February 15, 2012

Exporting Stored Procedures

I have to retrieve all the stored procedures in a certain database via a aspx page. My problem is that I have basically no idea how to do it. I did manage to get all the data as XML and reconstruct the database (pain). All I need now (I hope) is the sprocs. I do not have any other access to the database. And I'm a novice with SQL Server. Any guidance is appreciated.

SteveSomething like:

select text
from syscomments
where text like 'create procedure%'
|||Thank you very much.

I also have to restore the sprocs. Should I select all the columns in syscomments and sysobjects for the relevent rows and insert them into the new db? Will that do it?

Thanks again,

Steve|||NO, I do not recommend this approach.. Why are you looking to perform these activities through an asp.net application?|||I have a client with a developer problem. They asked me to coordinate with the developer to facilitate moving the site. Despite the developer's statements that I could access the SQL Server, he only gave me FTP access to the site. Eventually, I find out that he is intentionally being difficult, refusing to assist unless the client paid him more money. Apparently a _lot_ more money. I found in his connection code where he recently changed the pw to the database, to something other than what he told me. I assume the developer is being unreasonable to the point where it is cheaper to have me do it the "hard" way. Oh yeah, this is a classic ASP app, which I have no experience with either.

So... I had to use an aspx page to get the data via XML. Easy enough, but restoring it was a bit more challenging. I finally have the tables restored properly; now all I need is the stored procedures (I hope).

I did get the procedures (thanks again), however I had to get all the rows because none of the sprocs begin with the string you suggested, and I'm wanderin' around in the dark.

I'm amazed I've accomplished what I have. It's a good thing .NET is so smart. :)

Steve|||Thanks to your help, I was able to completely reconstruct the database!

I had to manually re-add the stored procedures, views & triggers I got from your suggestion. In the end, it was the easiest way.

Thanks again,

Steve

No comments:

Post a Comment