January 15, 2009 at 3:23 am
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
January 15, 2009 at 9:10 am
SHAPE and APPEND are not valid T-SQL key words. Here's an article on how to use them:
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply