Re: Executing a SQL script on server
Take out all the GO commands
>From BOL
"GO is not a Transact-SQL statement; it is a command recognized by the osql
and isql utilities and SQL Query Analyzer.
SQL Server utilities interpret GO as a signal that they should send the
current batch of Transact-SQL statements to SQL Server"
--
Terry Kreft
"David De Bono" <er_fortsatt@xxxxxxxxxxx> wrote in message
news:Oh9sAsZEGHA.3384@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> How can I using ADO send a SQL script to the server to be executed there ?
>
> Example script:
>
> USE [e-Lector]
>
> GO
>
> EXEC sp_addrolemember N'db_datareader', N'eanew'
>
> GO
>
> USE [e-Lector]
>
> GO
>
> EXEC sp_addrolemember N'db_datawriter', N'eanew'
>
> GO
>
> ---------------------------------
>
> I have tride to send it via the Execute method, but it fails on "GO"
>
>
>
> Please help!
>
> David
>
>
.
Relevant Pages
- Re: How to get list of EventClasses in MSSQLServer2000
... out using this procedure any system tables is available on SQL Server 2000. ... Errors','Indicates that an OLE DB error has occurred.') ... Plan','Displays the plan tree of the Transact-SQL statement executed.') ... (microsoft.public.sqlserver.security) - Re: Stored Procedures
... this is also happening for inline T-SQL, however with a SP this can in the case of a SQL batch and with optimizations much more efficient beside the advantage of encapsulation security etc etc ... ... However when is something called then "Compiled" as our .Net / Java assembly`s are JITTED we just create the SQL counterpart of an execution plan ... "A stored procedure is compiled at execution time, like any other Transact-SQL statement" ... "A stored procedure is not saved in its compiled version outside the cache, the same as any other Transact-SQL statement" ... (microsoft.public.dotnet.languages.vb) - Re: Stored Procedures
... the same as any other Transact-SQL statement" ... case of a SQL batch and with optimizations much more efficient beside the ... "A stored procedure is not saved in its compiled version outside the ... statements compiled into a single execution plan." ... (microsoft.public.dotnet.languages.vb) - Re: Works in Query Analyzer, why not in SqlCommand.ExecuteQuery() ?
... GO is not a Transact-SQL statement; it is a command recognized by the osql ... and isql utilities and SQL Query Analyzer. ... SQL Server utilities interpret GO as a signal that they should send the ... Analyzer and the osql and isql command prompt utilities implement GO ... (microsoft.public.dotnet.framework.adonet) - Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
... I moved every table I was able to move to the SQL ... closed connections - but all of these errors are in the version which used ... the SQL Server 2000 and everything worked ... communication between ODBC (OLEDB and Native Client, ... (microsoft.public.sqlserver.connect) |
|