Solved

Multiple tables with Stored Procedures

Posted on 2004-04-29
6
266 Views
Last Modified: 2013-12-24
Hi,

I'm calling a stored procedure. It returns two tables. Using <cfquery> how do I assign the two tables to two variables/structures/queries?

Thanks,

Stoke

<cfquery datasource="#dsource#" name="findAccomsByAliasList">
      DECLARE @RC int
      DECLARE @licence varchar(128)
      DECLARE @aliasSetType varchar(8000)
      DECLARE @imgSize varchar(128)
      DECLARE @imgPrefix varchar(128)
      DECLARE @imgFileType varchar(128)
      DECLARE @imgOperatorLogo varchar(128)
      SELECT @licence = '#licence#'
      SELECT @aliasSetType = '#aliasSetType#'
      EXEC @RC = [TrailStream].[dbo].[findAccomsByAliasList] @licence, @aliasSetType, DEFAULT, DEFAULT, DEFAULT, DEFAULT
</cfquery>
0
Comment
Question by:Stoke
  • 3
  • 3
6 Comments
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10954313
Use the tag cfstoredproc and cfprocresult for each result.

<cfstoredproc ............>
    .......................
    <cfprocparam .............>
    <cfprocresult name="qOne" resultset="1">
    <cfprocresult name="qTwo" resultset="2">
</cfstoredproc>
0
 

Author Comment

by:Stoke
ID: 10957446
Thanks.
But I get the following error:

Invalid CFML construct found on line 30 at column 55.
ColdFusion was looking at the following text:

qONE

# An expression that began on line 28, column 64.
Your expression might be missing an ending "#" (it might look like #expr ).
# the tag attribute "value", on line 28, column 43.
# a cfprocparam tag beginning on line 26, column 26.
# a cfprocparam tag beginning on line 26, column 26
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10957728
Can I see your code? I hope you did not exactly copied what I typed, what I typed was just to give you an idea ;-)
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:Stoke
ID: 10957851
Sure... Thank you:

<cfstoredproc datasource="#dsource#" procedure="findAliasList" >
      <cfprocparam type = "IN"
             CFSQLType = CF_SQL_VARCHAR
                    value = "#licence#"  dbVarName = @licence >
      <cfprocparam type = "IN"
             CFSQLType = CF_SQL_VARCHAR
                    value = "aliasSetType#"  dbVarName = @aliasSetType >

      <cfprocresult name = "qONE" resultset="1">
      <cfprocresult name = "qTWO" resultSet = "2">
</cfstoredproc>
0
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 50 total points
ID: 10958061
 dbVarName does not work, you need to pass the parameters in the order the are in the SP.

the problem is here
<cfprocparam type = "IN"
           CFSQLType = CF_SQL_VARCHAR
                 value = "aliasSetType#"  dbVarName = @aliasSetType >

it needs to be

<cfprocparam type = "IN"
           CFSQLType = CF_SQL_VARCHAR
                 value = "#aliasSetType#"  dbVarName = @aliasSetType >

you were missing a # infront of aliassettype
0
 

Author Comment

by:Stoke
ID: 10958097
That's great. Thanks... That's going to prove really useful.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
New OSQA server has a ton of fake users 4 70
Help with a redirect in web.config file 8 56
Soundcloud.com 4 43
Two wordpress questions 3 61
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question