|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Creating multiple Stored procedure on SQL Server through ADOI want to create a set of procedures through my application on SQL Server, through 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 multiple calls. Thanks Pushkar Instead of GO use a semicol for this:
Use DB1; create procedure <procedurename> ... HTH, Jens Suessmeyer. Jens (J***@sqlserver2005.de) writes:
> Instead of GO use a semicol for this: use tempdb;> > Use DB1; > create procedure <procedurename> ... > > HTH, Jens Suessmeyer. > 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, esq***@sommarskog.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp 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" <pushkartiw***@gmail.com> wrote in message news:uDUQl6h1FHA.736@tk2msftngp13.phx.gbl... I want to create a set of procedures through my application on SQL Server, through ADO.Hi, 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 multiple calls. Thanks Pushkar |
|||||||||||||||||||||||