Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9188675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:04:16+00:00 2026-06-17T20:04:16+00:00

When I execute a stored proc via cfstoredproc , I am getting a different

  • 0

When I execute a stored proc via cfstoredproc, I am getting a different result than calling that stored proc via cfquery. I am passing in the same exact parameter values to each call. And also, when I run the stored proc in SQL Studio, I get the correct results (same as the cfquery).

Here’s the cfstoredproc call

<cfstoredproc datasource="#request.mainDSN#" debug="#request.debug#" procedure="rankingresults">
   <cfprocparam type="in" value="8652" CFSQLType="CF_SQL_INTEGER">
   <cfprocparam type="in" value="50" CFSQLType="CF_SQL_INTEGER">
   <cfprocparam type="in" value="53" CFSQLType="CF_SQL_INTEGER">
   <cfprocresult name="local.listing">
</cfstoredproc>

Here is the cfquery call

<cfquery datasource="#request.mainDSN#" name="rankings">
   EXEC rankingresults
    @CityZipId = 8652,
    @distance = 50,
    @sic = 53
</cfquery>

The results are completely different. It’s not even close. I’ve been banged my head over this for several hours, and I can’t figure out why it is doing what it is doing.

UPDATE

The stored proc is massive (and one that I inherited), so I’m not going to paste it all here: http://pastebin.com/EtufPWXf

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:04:17+00:00Added an answer on June 17, 2026 at 8:04 pm

    (From the comments)

    Looks like it does have optional parameters. So your cfstoredproc call may not be passing in the values you think it is. Based on the order, it looks like it is actually passing in values for: @CityZipID, @Sic, @lastRank. As Dan mentioned (and I hinted at), cfstoredproc uses positional notation for parameters (@dbVarName is deprecated). You need to supply all of the parameter values in the correct order.

    Update:

    FWIW, if you create a shell procedure you would see the cfstoredproc and cfquery are actually invoking the procedure with different parameters/values. (See below).

    You would definitely see a difference in results if you invoked the procedure without the named parameters as @Dan suggested ie exec rankingresults 8652, 50, 53. (I know you said there was “no change”, but there was probably just an error in your test).

    CFSTOREDPROC

    @ATTRCODES|@CITYZIPID|@DISTANCE|@HASURL |@ISFEATURED |@LASTRANK|@PHOTOCOUNT|@REVIEWCOUNT |@SIC|@SICBUDGETIDS 
    (nothing)| 8652| (nothing)| (nothing)| (nothing)| 53| (nothing)| (nothing)| 50| (nothing)
    

    CFQUERY

    @ATTRCODES|@CITYZIPID|@DISTANCE|@HASURL |@ISFEATURED |@LASTRANK|@PHOTOCOUNT|@REVIEWCOUNT |@SIC|@SICBUDGETIDS 
    (nothing)| 8652| 50| (nothing)| (nothing)| 0| (nothing)| (nothing)| 53| (nothing)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to execute an Oracle stored proc via an Entity Framework data
I would like to execute a stored proc that simply updates a record. At
I have a stored proc that I need to execute 100 times (one for
Say I've got stored proc 1, that returns some data. how can I execute
I'm attempting to use context.Database to execute a stored proc that inserts a record
how can i execute a stored proc in mysql db? i have to pass
Got a strange problem created a little stored proc which need to execute a
I'm working on a stored proc that executes some dynamic sql. Here's the example
Is there anyway I can execute stored procedure via EXEC (so not specifying CommandType.StoredProcedure
Usually when I execute a stored proc from C# (ASP.NET 3.5), I have to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.