Link to home
Start Free TrialLog in
Avatar of Ray
RayFlag for United States of America

asked on

querying from Excel and using multiple statements separated by semicolon

I am trying to feed this query to a DB2 database via excel.  I get an error message back from the db that is complaining about syntax of a semicolon.  
When I run the exact same text as a query in a native db query application it runs just fine, no issues.  

Any thoughts on why sending this via Excel is a problem?  
Any way to get around it aside from running each one as a separate query?
 

 drop alias qtemp.zz1 ;  drop alias qtemp.zz2 ;  drop alias qtemp.zz3 ;  drop alias qtemp.zz4 ;  drop alias qtemp.zz5 ;
Avatar of Member_2_2484401
Member_2_2484401
Flag of United States of America image

What is the exact error-message that you receive?
Avatar of Ray

ASKER

Dave,
It is attached but it won't tell you anything.  I get the exact same error even running ONE of those (such as:  drop alias qtemp.zz1 ; ) if I include the semicolon.  

The bottom line appears to be that passing a semicolon to a query engine via VBA is problematic.
semicolon-error.PNG
SOLUTION
Avatar of [ fanpages ]
[ fanpages ]

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of [ fanpages ]
[ fanpages ]

Thanks Ray.

You may wish to look at the difference between "atomic" & "non-atomic" Compound Dynamic SQL Statements, if you are going with the "BEGIN...END" transaction-based route:

[ http://www.mcpressonline.com/sql/techtip-compound-dynamic-sql-statements.html ]

PS. You did not mention Part 2 until now, otherwise I would have suggested the approach you mentioned.

Good luck in any respect.
Avatar of Ray

ASKER

Fanpages, I didn't know about part 2 'til after I conquered part 1    :-)
Avatar of Ray

ASKER

Solved it with some intra-company help.