Actually, GO in Query analyzer doesn;t combine multiple queries, it separates
them and causes them to be executed as separate requests to the server. For a
simple series of UPDATE statements, SQL Server doesn't require GO between them
at all.
In JET, you can't execute multiple statements in one call, so you simply need
to execute one statement per call (equivalent to using GO in Query Analyzer).
If you want to prepare a set of statements prior to calling a single procedure
to execute them all, the simplest way I know of is to build a collection of
SQL statements or a collection of Querydef objects, and pass that to a
procedure that loops through the items in the collection using For Each,
executing each statement in a loop.
If you want, you could actually parse out <newline>GO<newline> from a set of
statements in a single string using the Split function, and use vbCrLf & "GO"
& vbCrLf as the delimiter. That gives you an array of SQL statements you can
loop through.
On 18 Jan 2005 08:23:44 -0800, "marty3d" <ma****@martinkjellberg.com> wrote:
Hi!
I'm trying to create one query by combining several smaller UPDATE,
INSERT and DELETE queries. I know this is easily done in SQL Server
using GO, but I can't figure out how to do it in Access.
Is it even possible, or are there at least any workarounds?
My goal is for my client to just have to run a query (or a macro or
something) to update his products table with a previously imported
table (same formatting on both tables).
Thanks alot, this one has been bugging me for a while!