473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Generate SPs as text

Is there an easy way to loop through every stored procedure in a
database and create a file containing all of the SP code?
lq
Jul 20 '05 #1
9 3769
> Is there an easy way to loop through every stored
procedure in a database and create a file containing
all of the SP code?
lq


I would suggest one of three ideas (in order of ease of use and
compatibility across versions of SQL Server):

1. Enterprise Manager can do this for you

2. You can write a program using SQLDMO to do this. If you've never used
SQLDMO before, you'll want to loop through the StoredProcedure objects in
the Database object. You'll also want to look up the SystemObject property
and the Script method. In addition, we've found that it's easier to have
SQLDMO script the actual proc, while we handle adding script for dropping
the procedure before creating and for granting permissions (but this will
depend on how you control SP's and their permissions).

3. See the technique I mentioned in the thread "Search contents of stored
procedures?" for a down-and-dirty (not to mention fragile) technique.

Craig
Jul 20 '05 #2
Dear Laurenquantrell

By joining sysobject and syscomments table we can get your desired results,
run this query in Query Analyzer (with result in text mode)....
-----------------------------------------------------------------------------
SELECT dbo.syscomments.text, dbo.sysobjects.name
FROM dbo.syscomments INNER JOIN
dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.xtype = 'p')
-----------------------------------------------------------------------------
Best of luck!

Saghir Taj

la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Is there an easy way to loop through every stored procedure in a
database and create a file containing all of the SP code?
lq

Jul 20 '05 #3
Thank you very much for that. It is very helpful. Now I just need an
easy way to unencrypt all the SPs I encrypted with "With
Encryption"...
lq

Sa********@hotmail.com (Saghir Taj) wrote in message news:<f5**************************@posting.google. com>...
Dear Laurenquantrell

By joining sysobject and syscomments table we can get your desired results,
run this query in Query Analyzer (with result in text mode)....
-----------------------------------------------------------------------------
SELECT dbo.syscomments.text, dbo.sysobjects.name
FROM dbo.syscomments INNER JOIN
dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.xtype = 'p')
-----------------------------------------------------------------------------
Best of luck!

Saghir Taj

la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Is there an easy way to loop through every stored procedure in a
database and create a file containing all of the SP code?
lq

Jul 20 '05 #4
Dear Laurenquantrell

By joining sysobject and syscomments table we can get your desired results,
run this query in Query Analyzer (with result in text mode)....
-----------------------------------------------------------------------------
SELECT dbo.syscomments.text, dbo.sysobjects.name
FROM dbo.syscomments INNER JOIN
dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.xtype = 'p')
-----------------------------------------------------------------------------
Best of luck!

Saghir Taj

la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Is there an easy way to loop through every stored procedure in a
database and create a file containing all of the SP code?
lq

Jul 20 '05 #5
Dear

I am afraid that we can not decrypt a encrypted object! till the SQL
2000. so wait till i find any undocmented function or third party tool
which can do the trick...

Best of luck

Me,
Saghir Taj



la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Thank you very much for that. It is very helpful. Now I just need an
easy way to unencrypt all the SPs I encrypted with "With
Encryption"...
lq

Sa********@hotmail.com (Saghir Taj) wrote in message news:<f5**************************@posting.google. com>...
Dear Laurenquantrell

By joining sysobject and syscomments table we can get your desired results,
run this query in Query Analyzer (with result in text mode)....
-----------------------------------------------------------------------------
SELECT dbo.syscomments.text, dbo.sysobjects.name
FROM dbo.syscomments INNER JOIN
dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.xtype = 'p')
-----------------------------------------------------------------------------
Best of luck!

Saghir Taj

la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Is there an easy way to loop through every stored procedure in a
database and create a file containing all of the SP code?
lq

Jul 20 '05 #6
Dear

I am afraid that we can not decrypt a encrypted object! till the SQL
2000. so wait till i find any undocmented function or third party tool
which can do the trick...

Best of luck

Me,
Saghir Taj



la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Thank you very much for that. It is very helpful. Now I just need an
easy way to unencrypt all the SPs I encrypted with "With
Encryption"...
lq

Sa********@hotmail.com (Saghir Taj) wrote in message news:<f5**************************@posting.google. com>...
Dear Laurenquantrell

By joining sysobject and syscomments table we can get your desired results,
run this query in Query Analyzer (with result in text mode)....
-----------------------------------------------------------------------------
SELECT dbo.syscomments.text, dbo.sysobjects.name
FROM dbo.syscomments INNER JOIN
dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.xtype = 'p')
-----------------------------------------------------------------------------
Best of luck!

Saghir Taj

la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Is there an easy way to loop through every stored procedure in a
database and create a file containing all of the SP code?
lq

Jul 20 '05 #7
Thank you very much for that. It is very helpful. Now I just need an
easy way to unencrypt all the SPs I encrypted with "With
Encryption"...
lq

Sa********@hotmail.com (Saghir Taj) wrote in message news:<f5**************************@posting.google. com>...
Dear Laurenquantrell

By joining sysobject and syscomments table we can get your desired results,
run this query in Query Analyzer (with result in text mode)....
-----------------------------------------------------------------------------
SELECT dbo.syscomments.text, dbo.sysobjects.name
FROM dbo.syscomments INNER JOIN
dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.xtype = 'p')
-----------------------------------------------------------------------------
Best of luck!

Saghir Taj

la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Is there an easy way to loop through every stored procedure in a
database and create a file containing all of the SP code?
lq

Jul 20 '05 #8
Dear

I am afraid that we can not decrypt a encrypted object! till the SQL
2000. so wait till i find any undocmented function or third party tool
which can do the trick...

Best of luck

Me,
Saghir Taj



la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Thank you very much for that. It is very helpful. Now I just need an
easy way to unencrypt all the SPs I encrypted with "With
Encryption"...
lq

Sa********@hotmail.com (Saghir Taj) wrote in message news:<f5**************************@posting.google. com>...
Dear Laurenquantrell

By joining sysobject and syscomments table we can get your desired results,
run this query in Query Analyzer (with result in text mode)....
-----------------------------------------------------------------------------
SELECT dbo.syscomments.text, dbo.sysobjects.name
FROM dbo.syscomments INNER JOIN
dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.xtype = 'p')
-----------------------------------------------------------------------------
Best of luck!

Saghir Taj

la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Is there an easy way to loop through every stored procedure in a
database and create a file containing all of the SP code?
lq

Jul 20 '05 #9
Dear

I am afraid that we can not decrypt a encrypted object! till the SQL
2000. so wait till i find any undocmented function or third party tool
which can do the trick...

Best of luck

Me,
Saghir Taj



la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Thank you very much for that. It is very helpful. Now I just need an
easy way to unencrypt all the SPs I encrypted with "With
Encryption"...
lq

Sa********@hotmail.com (Saghir Taj) wrote in message news:<f5**************************@posting.google. com>...
Dear Laurenquantrell

By joining sysobject and syscomments table we can get your desired results,
run this query in Query Analyzer (with result in text mode)....
-----------------------------------------------------------------------------
SELECT dbo.syscomments.text, dbo.sysobjects.name
FROM dbo.syscomments INNER JOIN
dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.xtype = 'p')
-----------------------------------------------------------------------------
Best of luck!

Saghir Taj

la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
Is there an easy way to loop through every stored procedure in a
database and create a file containing all of the SP code?
lq

Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Øyvind Isaksen | last post by:
Hello! I need to dynamic generate a SQL statement based on how many images a user select to upload. Here you see an example with 2 images. It can be up to 50 images and I dont want to write...
1
by: tconti | last post by:
Howdy: I have 2 general questions regarding the use of XSLT to generate emails. We have several procecesses that use XSLT to generate emails. We frequently run into issues where a client...
2
by: SalimShahzad | last post by:
Dear Gurus, i had written following codes to auto generate the next claim no Private Const strC = "GCT/02/J/" Private Sub Command1_Click() Dim stra, stre As String Dim intb, intd As Integer...
2
by: Stephen Tang | last post by:
Hi, I'm relatively new at this language, so I've been trying to find parallels to problems I've run into in the past. This is the hypothetical problem: I want to write a CD inventory...
6
by: comp.lang.php | last post by:
/** * Generate the random security image * * @access public * @param $willUseFilePath (default false) boolean to determine if you will be using a file path * @param mixed $filePath (optional)...
0
by: Avon | last post by:
Hi friends, I am very sorry for my not perfect English. I have one question, I am using David Bauer's DynamicControlsPlaceholder to dinamically generate controls and I am tryig to generate...
10
by: subhadip | last post by:
Hi, I want to generate New mail alert for any mail client at client side . I want to check if any new mail has arrived in my inbox or not . the mail client be anything . I want to do this for...
3
by: isis | last post by:
Hi all, I have been googling ard for days and I am still unable to find a solution to generate ids uniquely hence I would like to appeal for urgent help here. I have a table and for this...
1
by: pitchke | last post by:
Hey guys...i have developed a code to generate random text and i want to convert the resulting text into a image form...for reference..you people would have come this kind of images while registering...
3
by: cleary1981 | last post by:
Hi, I know how to generate xml from php but is there an easier way to generate xml from my code? <?php $quote=$_GET; //echo $quote; require "config.php"; $q1 = mysql_query("SELECT * FROM...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.