Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Syntax error when use ExecuteWithResultsAndMessages instead of ExecuteImmediate

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-05-05 : 07:51:32
Ziming writes "Hi All,

I am a beginner of DMO. I am trying to send a sql batch via ExecuteImmediate of Database object. It works good, but if I want to catch more message by using ExecuteWithResultsAndMessages, DMO complains that there are syntax errors in my .sql file which runs perfectly before! Can anybody please tell me why? I have some pieces of this file here.

setuser 'dbo'
GO

EXEC sp_addtype 'UDTComment', 'varchar (255)', 'null'
GO

Errors returned:

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 19: Incorrect syntax near 'GO'.
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 22: Incorrect syntax near 'GO'.
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 32: Incorrect syntax near 'GO'.
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 45: Incorrect syntax near 'GO'.
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 53: Incorrect syntax near 'GO'.
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'if'.
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 863: Incorrect syntax near 'GO'."

X002548
Not Just a Number

15586 Posts

Posted - 2003-05-05 : 10:48:54
Ummmm...

I guess you could probably figure it out (remove the GO statements for a start), but don't you have any of the SQL Server Client tools installed?

I would imagine that would make your life MUCH easier.

And even if you had to call soemthing, you could create a *.sql (or a text file) and execute it via osql.

MOO



Brett

8-)
Go to Top of Page
   

- Advertisement -