Hi,
I want to create a set of procedures through my application on SQL Server, t
hrough ADO.
My Scipts is something of the form:
Use DB1
Go
create procedure <procedurename>
as
< procedure text>
Go
Create Procedure <procedurename>
as
<procedure text>
Go
But when I execute this statement it gives error 'Error in line 2 Go'
Is there a way to excute this script in a single call or I have to make mult
iple calls.
Thanks
PushkarInstead of GO use a semicol for this:
Use DB1;
create procedure <procedurename> ...
HTH, Jens Suessmeyer.|||You can't pass GO through ADO, as GO isn't a SQL command. For each GO, do an
.Execute of your
command object.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Pushkar" <pushkartiwari@.gmail.com> wrote in message news:uDUQl6h1FHA.736@.tk
2msftngp13.phx.gbl...
Hi,
I want to create a set of procedures through my application on SQL Server, t
hrough ADO.
My Scipts is something of the form:
Use DB1
Go
create procedure <procedurename>
as
< procedure text>
Go
Create Procedure <procedurename>
as
<procedure text>
Go
But when I execute this statement it gives error 'Error in line 2 Go'
Is there a way to excute this script in a single call or I have to make mult
iple calls.
Thanks
Pushkar|||Jens (Jens@.sqlserver2005.de) writes:
> Instead of GO use a semicol for this:
> Use DB1;
> create procedure <procedurename> ...
> HTH, Jens Suessmeyer.
>
use tempdb;
CREATE PROCEDURE blafs AS
SELECT 'Uhuh'
gives:
Server: Msg 111, Level 15, State 1, Line 2
'CREATE PROCEDURE' must be the first statement in a query batch.
; is a statement terminator, handled by SQL Server.
GO is a batch terminator, handled client-side by some query tools.
GO and ; fills different purposes.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment