Results 1 to 2 of 2

Thread: Syntax help

  1. #1
    Join Date
    Feb 2006
    Posts
    2

    Unanswered: Syntax help

    Basically what I am working with is there are around 40 stored procedures running off this one page.. each different one called based off a huge if statement.

    In each different sp there are variables set in the sp themselves.
    Ex:
    SET @WhereData = 'TransactionType = ''D'''

    Then called in the select statement of the sp by:

    WHERE ( ' + @WhereData + ' )


    I'm trying to turn it into one sp and trying to send the variable data to the sp via the webpage by:

    varPhrase = "TransactionType = 'D'"


    SQL = "Execute tmTranslist '" & Session("tmSiteID") & "', 'BatchDate', '" & Session("tmBatchDateFrom") & "', '" & Session("tmBatchDateTo") & "', '" & varPhrase & "', '" & tmEntryClass & "', '" & Session("tmOrderBy") & "'"


    If I run the code just in query analyzer:
    Execute tmTranslist 'P0AJ', 'BatchDate', '04/01/2008', '04/01/2008', 'TransactionType = ''D''', 'ARC', 'Batchdate'

    I get this error:
    Incorrect syntax near 'D'. Those are all single quotes around D btw.

    When I run the webpage I don't get any errors but it also doesn't show the data that I know is there.

    I've tried a bunch of crap with different syntax's but can't get anything to work any ideas?

    Thanks!

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    looks like you have a dynamic search condition. read this:

    http://sommarskog.se/dyn-search.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •