SHAPE command coming up with error - HELP!!

  • I have an old web app written in classic asp and the following SHAPE command works perfectly:

    SUB selectProducts()

    strShape = ""

    if typeID = 0 then

    strShape = strShape & "SHAPE {SELECT * FROM CS_Products WHERE CS_Products.Range_ID=" & rangeID & "} "

    else

    strShape = strShape & "SHAPE {SELECT * FROM CS_Products WHERE CS_Products.Type_ID = " & typeID&"} "

    end if

    strShape = strShape & "APPEND ({SELECT * FROM CS_Product_Options} "

    strShape = strShape & "RELATE Prod_ID TO Prod_ID) AS rsOptions"

    'Response.Write(strShape)

    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ' Open the Shaped Recordset

    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    objRESProducts.Open strShape, strShapeConn

    END SUB

    When I run it live and uncomment the Response.Write, I get the following SQL query:

    SHAPE {SELECT * FROM CS_Products WHERE CS_Products.Range_ID=3} APPEND ({SELECT * FROM CS_Product_Options} RELATE Prod_ID TO Prod_ID) AS rsOptions

    The asp runs perfectly but when I run this query in SQL Management Studio Express directly against the CS_Products table it says:

    Incorrect syntax near the keyword 'SELECT'

    There's probably something obvious I'm missing but I'm really tearing my hair out on this one so can anyones please offer some ideas?

    Many thanks

    Lorna

  • SHAPE and APPEND are not valid T-SQL key words. Here's an article on how to use them:

    http://support.microsoft.com/kb/189657

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply