Solved

Multiple tables with Stored Procedures

Posted on 2004-04-29
6
262 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now