0

My website has email templates in order to send email notifications to users. Each template relies on running a stored procedure to obtain it's dataset to be merged into the body of the email message. My challenge is that it's not always easy for me to determine which fields are available to be added into each email template. It'd therefore be very handy to be able to "test-run" a stored procedure when editing an email template in order to enumerate the list of available fields.

Example provided below for context:

SELECT fieldnames FROM 'sp_get_items @strInput=''ABC''

Returned values:

item_id
item_name
item_cost
item_count

Like SHOW COLUMNS but for a stored procedure.

ChrisFNZ
  • 597
  • 1
  • 4
  • 21
  • 1
    Possible duplicate of [How to list mysql stored procedure parameters](http://stackoverflow.com/questions/9546378/how-to-list-mysql-stored-procedure-parameters) – Shaharyar Apr 23 '16 at 22:50
  • I'm not wanting to list the (input) parameters of a stored procedure, but rather the (output) fieldnames of the resulting dataset which the stored procedure produces. – ChrisFNZ Apr 23 '16 at 22:53
  • Sorry I think I misunderstood the question, you want to call the procedure and see the output? Because output can not be seen without calling it with required params. – Shaharyar Apr 23 '16 at 22:55
  • I want to "test" call the stored procedure so I'm returned only a list of the fields as a dataset, rather than the stored procedure's usual resulting (output) dataset itself. – ChrisFNZ Apr 23 '16 at 22:57
  • You can't do that on MySql, you would need some table from information schema that show the code and from it do a parser. You can, however, knowing the parameters call the procedure and parse the result but it would be a lot of work to do something like this I'm pretty sure no one here would take time to do it, I hope I'm wrong and someone feel challenged by this comment and do it, though! :) – Jorge Campos Apr 23 '16 at 23:01
  • Yeah if someone offers great bounty :) I think you should call all of them once and create a table to store the values, this could be a quick workaround rather than writing a complex code and get the output field list. – Shaharyar Apr 23 '16 at 23:08
  • Ah Yes, thanks for the suggestion. I was hoping to avoid that and keep it dynamic if possible! – ChrisFNZ Apr 23 '16 at 23:10

0 Answers0