I am using ASP to build a query which includes derived tables. When I loaded the page I get the following error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ' '.
In an attempt to troubleshoot I have simplified the query and table to it's simplies form and am still getting the same error.
here is the ASP code:
-------------------------------------------
Set objCon = Server.CreateObject("ADODB.Connection"
Set objRec = Server.CreateObject("ADODB.Recordset"
objcon.open "DSN=myDB","username","password"
SQL = "SELECT * FROM "
SQL = SQL & "("
SQL = SQL & "SELECT * "
SQL = SQL & "FROM orders"
SQL = SQL & "
OST"
objrec.open SQL,objcon,3,3
-------------------------------------------
Produces the query:
SELECT * FROM (SELECT * FROM orders) OST
If I copy and past this into a view or query analyzer it works fine. The table now only has one varchar column in it. Any thoughts on what is happening?
thanks in advance,
gordy
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ' '.
In an attempt to troubleshoot I have simplified the query and table to it's simplies form and am still getting the same error.
here is the ASP code:
-------------------------------------------
Set objCon = Server.CreateObject("ADODB.Connection"
Set objRec = Server.CreateObject("ADODB.Recordset"
objcon.open "DSN=myDB","username","password"
SQL = "SELECT * FROM "
SQL = SQL & "("
SQL = SQL & "SELECT * "
SQL = SQL & "FROM orders"
SQL = SQL & "
objrec.open SQL,objcon,3,3
-------------------------------------------
Produces the query:
SELECT * FROM (SELECT * FROM orders) OST
If I copy and past this into a view or query analyzer it works fine. The table now only has one varchar column in it. Any thoughts on what is happening?
thanks in advance,
gordy