Skip navigation
Currently Being Moderated

Queries not working in CF......

May 2, 2012 7:56 AM

Tags: #cfquery #coldfusion9 #cfc

Good morning all,



I have this query that I can run in SQL Server Management Studio but it will not run in ColdFusion. Do I need to put in a stored procedure to run the below code?


<cffunction name="itmChk" returntype="query">

    <cfargument name="searchPO" required="yes">

    <cfquery name="itemCheck" datasource="#REQUEST.datasource#">

    select ordno, itnbr, house, poisq, blcod, b_blksq, cmpdt, itdsc, engno, itcls, duedt, umord, qtyor, stkqt, staic, vndnr, vname, b_relqt, b_reldt, b_stkqt, b_staic, pitd1, pitd2, duedate

        from recvTemp t

        where t.ordno = '#arguments.searchPO#'  and not exists(select *

                                         from recvLogTest r

                                         where t.ordno = r.ordno and t.itnbr = r.itnbr)


    <cfreturn itemCheck>



Thanks for any help!!!



  • Currently Being Moderated
    May 2, 2012 8:24 AM   in reply to djkhalif

    What do you mean "will not run"?


    Recommend you read this:




    Mark as:
  • Currently Being Moderated
    May 2, 2012 9:50 AM   in reply to djkhalif

    I would check to see what value is being passed to the query and even email yourself a dump of the query after it runs (which will include the actual query it is running). Then copy and paste that into SSMS and see if it returns records.

    Mark as:
  • Currently Being Moderated
    May 4, 2012 6:28 AM   in reply to djkhalif

    You might also use SQL Profiler to view the query that is being excuted.


    "SQL Server Profiler Step by Step" Step


    "Getting ColdFusion SQL Statements from SQL Server Trace"

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points