Skip to main content
Inspiring
April 7, 2009
Question

T-SQL & ColdFusion MX Stored Procedure

  • April 7, 2009
  • 1 reply
  • 2815 views

This is so basic but it is kicking my butt.

I am doing a simple user verification and if they verify their info is passed out of the SP.

So what I can't find is how to pass the query result out to CF.

I can't even find any good tutorials on it anywhere.

Do I use a cursor? Do I use another variable and if so what type? What do I do on the CF side?

I actually have this in Oracle but now need to put it in MSSQL and it just isn't passing the info to CF from t-sql.

This topic has been closed for replies.

1 reply

Participating Frequently
April 8, 2009

Returning result sets from a TSQL stored procedure is much easier than with Oracle.

It is much better to use the CFSTOREDPROC tag to run procedures as opposed to CFQUERY.  In your stored procedure, you use a SELECT statement to get the data you want - you can return more than query result set from the stored procedure if you use the CFSTOREDPROCE tag, which is nice.

Before you close your proc tag, use the CFPROCRESULT tag to indentify the result set from the stored procedure and assign it a name in ColdFusion which you will use to output your results.  If you have more than one result set returned, you can use multiple CFPROCRESULT tags and indicate the result set number using the RESULTSET attribute.

Good luck!

Inspiring
April 8, 2009

It is much better to use the CFSTOREDPROC tag to run procedures as opposed to CFQUERY.


+1

As well as the documentation, you might also find this intro helpful

http://www.adobe.com/devnet/coldfusion/articles/stored_procs.html