SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Creating a Script from a Stored Procedure


Creating a Script from a Stored Procedure

Author
Message
RyanRandall
RyanRandall
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3215 Visits: 4652
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/rrandall/creatingascriptfromastoredprocedure.asp

Ryan Randall

Solutions are easy. Understanding the problem, now, that's the hard part.
AndreQ
AndreQ
SSC-Enthusiastic
SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)

Group: General Forum Members
Points: 120 Visits: 1
This is probably just a button for me, but I'd like Ryan to stay away from single letter variables. 'i' and 'q' don't tell me that much. Even if he uses iSuccess, it would be of help.

Handy content, though.



kokyan
kokyan
SSC Veteran
SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)

Group: General Forum Members
Points: 278 Visits: 1

Very good content. Help me a lot especially in debugging and printing reports directly from store procedures.

One question. Is the method sp_OAXXXXX create security issues, such as the person need certain special rights, such as belongs to sysAdmin?





Regards,
kokyan

Richard Haber
Richard Haber
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 Visits: 1

Thanks for the detailied method. I am constantly creating scripts from existing stored procs, but have always opened the proc in Query Analyzer and simply cut and pasted into a text document, or saved the query as a new file.

I'm curious as to when the need for this would arise.

Thanks


DBA_Rob
DBA_Rob
SSChasing Mays
SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)

Group: General Forum Members
Points: 632 Visits: 350

I came across this article while looking for a size limit on the sp_OAMethod output vaiable. It turns out that the 255 character limit that Ryan had in this article has been increased to at least 4000 bytes. See link http://support.microsoft.com/kb/325492.

The answer to the prior to posts (which I realize are old, but again in case some else comes to this article) are:

1) The sp_OA% procedures are in the master database and are not granted execute to anyone other that master dbo (basically sysadmin). You would either need to grant execute to these procedures to a user or role and add the user to master (or you could use public), or create the calling procedure (Ryan's proc) in master and just grant access to this calling procedure and the permissions should then inherit correctly since it is all within a single DB.

2) The reason you would do something like this in a procedure rather than copy/paste from a query window is if you were executing this as a batch job and not interactively.


Victor Arquero
Victor Arquero
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 163

What would be the right Script ID to be used in order to create a script that alters the existing SP Code?

Thanks


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search