SQL Trace to get SQL statement of Access query

SQL Trace to get SQL statement of Access query

Post by Tom Nichola » Mon, 04 Jan 1999 04:00:00



I want to use SQL trace to get the SQL statement of an Access query, which
has two subqueries, in order to create a strored procedure with this SQL
statement.

It doesn't however give the "group by" statements or the "SUMs" and various
others.  For another very similar query, SQL trace (or SQL Server Profiler
for version 7) does give the full sql statement (with "group by"s and "SUM"
and others).  I am assuming that the group bys and SUMs are carried out by
Access and not SQL Server.  How can I get the SQL statement?

 
 
 

SQL Trace to get SQL statement of Access query

Post by Andrew Novic » Tue, 05 Jan 1999 04:00:00


You probably can't.
Depending on what your query asks for the Access Engine/ODBC  combination
will decide how much of the query to pass to SQL Server.  When there are no
incompatabilities, the whole query is passed to sql server with the syntax
differences translated.  When there is something in the query that SQL
Server doesn't accept, such as a format function, access will construct a
query that pulls down the data it needs in raw form and processes the query
locally.

You may have to translate some of the queries by hand.  I've resorted to
writing programs to do the translation.

Good Luck.


>I want to use SQL trace to get the SQL statement of an Access query, which
>has two subqueries, in order to create a strored procedure with this SQL
>statement.

>It doesn't however give the "group by" statements or the "SUMs" and various
>others.  For another very similar query, SQL trace (or SQL Server Profiler
>for version 7) does give the full sql statement (with "group by"s and "SUM"
>and others).  I am assuming that the group bys and SUMs are carried out by
>Access and not SQL Server.  How can I get the SQL statement?