﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Ryan Randall / Article Discussions / Article Discussions by Author  / Creating a Script from a Stored Procedure / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 18 Jun 2013 01:56:59 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Creating a Script from a Stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic11674-115-1.aspx</link><description>&lt;P&gt;What would be the right Script ID to be used in order to create a script that alters the existing SP Code?&lt;/P&gt;&lt;P&gt;Thanks &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;&lt;/P&gt;</description><pubDate>Fri, 14 Sep 2007 03:25:00 GMT</pubDate><dc:creator>Victor Arquero</dc:creator></item><item><title>RE: Creating a Script from a Stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic11674-115-1.aspx</link><description>&lt;P&gt;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 &lt;A href="http://support.microsoft.com/kb/325492"&gt;http://support.microsoft.com/kb/325492&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;The answer to the prior to posts (which I realize are old, but again in case some else comes to this article) are:&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Thu, 13 Sep 2007 12:39:00 GMT</pubDate><dc:creator>DBA_Rob</dc:creator></item><item><title>RE: Creating a Script from a Stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic11674-115-1.aspx</link><description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;I'm curious as to when the need for this would arise.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description><pubDate>Thu, 17 Jun 2004 06:40:00 GMT</pubDate><dc:creator>Richard Haber</dc:creator></item><item><title>RE: Creating a Script from a Stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic11674-115-1.aspx</link><description>&lt;P&gt;Very good content. Help me a lot especially in debugging and printing reports directly from store procedures.&lt;/P&gt;&lt;P&gt;One question. Is the method sp_OAXXXXX create security issues, such as the person need certain special rights, such as belongs to sysAdmin?&lt;/P&gt;</description><pubDate>Tue, 04 May 2004 18:55:00 GMT</pubDate><dc:creator>kokyan</dc:creator></item><item><title>RE: Creating a Script from a Stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic11674-115-1.aspx</link><description>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. </description><pubDate>Thu, 01 May 2003 10:06:00 GMT</pubDate><dc:creator>AndreQ</dc:creator></item><item><title>Creating a Script from a Stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic11674-115-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF=http://www.sqlservercentral.com/columnists/rrandall/creatingascriptfromastoredprocedure.asp&gt;http://www.sqlservercentral.com/columnists/rrandall/creatingascriptfromastoredprocedure.asp&lt;/A&gt;</description><pubDate>Thu, 24 Apr 2003 00:00:00 GMT</pubDate><dc:creator>RyanRandall</dc:creator></item></channel></rss>