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?
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.
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.
What would be the right Script ID to be used in order to create a script that alters the existing SP Code?