Hi Bob, I tried putting a GO at the end, but I still get the same error. Any other ideas?
Thanks, Artie Bob Archer wrote: > > Put a GO at the end of the file. I think that might resolve it. > > BOb > > > -----Original Message----- > From: Artie Leech [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2008 6:34 AM > To: nant-users@lists.sourceforge.net > Subject: [NAnt-users] NAnt sql task fails, but code works in SQL Query > Analyzer > > > Hi, > > I'm trying to create a nant task that will build my database, which uses > SQL > Server 2000. > > I have the following line in a loop to load up a number of stored procs. > > <sql connstring="${database.project.connstring}" delimiter="GO" > transaction="true" batch="false" delimstyle="Normal" > source="${database.ddl.filename}"/> > > It's trying to load the stored proc code shown at the bottom of this > post. > > When I run my nant task, I get the following error: > > > "BUILD FAILED - 2 non-fatal error(s), 0 warning(s) > default.build(52,22): > Error while executing SQL statement. > Object reference not set to an instance of an object." > > However, if I remove the line "IF @@ERROR <> 0 GOTO finish", from the > code > below, then the build succeeds. > > Loading the proc through SQL Server Query Analyzer works fine - it's > just > from the NAnt sql task it fails. > > Any ideas as to what I'm missing here? > > Any help much appreciated! > > Artie > > > if exists (select * from dbo.sysobjects where id = > object_id(N'[dbo].[spr_myStoredProc]') and OBJECTPROPERTY(id, > N'IsProcedure') = 1) > drop procedure [dbo].[spr_myStoredProc] > GO > > CREATE PROCEDURE [dbo].[spr_myStoredProc] AS > > DECLARE @stat int > > BEGIN > > DELETE > FROM dbo.tbl_myTable > > SET @stat=@@ERROR > IF @@ERROR <> 0 GOTO finish > > -- other stuff edited out to narrow down the nant sql error > > finish: > > RETURN @stat > END > > -- > View this message in context: > http://www.nabble.com/NAnt-sql-task-fails%2C-but-code-works-in-SQL-Query > -Analyzer-tp19776861p19776861.html > Sent from the NAnt - Users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------ > - > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the > world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > NAnt-users mailing list > NAnt-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/nant-users > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the > world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > NAnt-users mailing list > NAnt-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/nant-users > > -- View this message in context: http://www.nabble.com/NAnt-sql-task-fails%2C-but-code-works-in-SQL-Query-Analyzer-tp19776861p19780945.html Sent from the NAnt - Users mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users