You might check out: http://www.thescripts.com/forum/thread143248.html
I looks like "GO" is a batch delimiter?
Chaohua Wang wrote:
Hi,
Thank you for your suggestion. But I used UTF-8,
It changed a little bit, still can not get through.
[sql] Executing file: C:\workspace\Canoo\billPay\tests\uspSelectCount.sql
[sql] Failed to execute: ?USE [BillPay] GO SET ANSI_NULLS ON GO SET
QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[uspSelectCount] AS BEGIN SET
NOCOUNT ON; Select count(*) from dbo.Payments_S
ng; End
[sql] java.sql.SQLException: Incorrect syntax near '?'.
Actually, I have no "?" in my sql file.
This my sql file:
USE [BillPay]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[uspSelectCount]
AS
BEGIN
SET NOCOUNT ON;
Select count(*)
from dbo.Payments_Staging;
End
-----Original Message-----
From: Olivier Gies [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 16, 2008 8:02 PM
To: Ant Users List
Subject: Re: ant sql call stored procedure
Hi,
It looks like the SQL file is encoded in some version of Unicode (UTF-8
or Unicode/UTF-16 ?), with each character using 2 bytes, and your <sql>
task is loading it in ISO-8599 by default.
You should verify your source file format (using 'file' command on *nix
systems, or any editing tool in Windows, e.g. UltraEdit32) and set the
<sql> task's "encoding" attribute accordingly (see
http://ant.apache.org/manual/CoreTasks/sql.html)
BR,
Olivier
-------- Original Message --------
Subject: ant sql call stored procedure
From: Chaohua Wang <[EMAIL PROTECTED]>
To: Chaohua Wang <[EMAIL PROTECTED]>, Ant Users List <user@ant.apache.org>
Date: 14/03/2008 06:31
Hi folks,
I am using ant sql to call a stored procedure of Ms Sql server
<sql
driver="${jdbcdriver}"
url="${dburl}/BillPay"
userid="${userid}"
password="${password}"
src=" uspSelectCount.sql "
classpathref="webtest.path.id"
</sql>
I can execute stored procedure in Ms Sql server. My stored procedure name is uspSelectCount. But when I am using ant sql to call the file uspSelectCount.sql that is located with the build file.
I always got this exception:
test:
[sql] Executing file: C:\workspace\Canoo\billPay\tests\uspSelectCount.sql
[sql] Failed to execute: ■U S E [ B i l l P a y ] G O / * * * * * *
O b j e c t : S t o r e d P r o c e d u r e [ d b o ] . [ u s p S e l e
c t C o u n t ] S c r i p t D
a t e : 0 3 / 1 3 / 2 0 0 8 1 5 : 5 1 : 1 3 * * * * * *
[sql] java.sql.SQLException: Incorrect syntax near 'E'.
[sql] Failed to execute: S E T A N S I _ N U L L S O N G O S E T
Q U O T E D _ I D E N T I F I E R O N G O - - = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = - - A u t h o r : < A u t h o r , , N a m e > -
- C r e a t e d a t e : < C r e a t e D a t e , , > - - D e s c r i p t i o n
: < D e s c r i p
t i o n , , > - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = C R E A T E P R O C E D U R E [ d b o ] . [ u
s p S e l e c t C o u n t ] A S B
E G I N - - S E T N O C O U N T O N a d d e d t o p r e v e n t
e x t r a r e s u l t s e t s f r o m - - i n t e r f e r i n g w i
t h S E L E C T s t a t e m e n t s .
S E T N O C O U N T O N ; S e l e c t c o u n t ( * ) f r o m d
b o . P a y m e n t s _ S t a g i n g E n d
[sql] java.sql.SQLException: Incorrect syntax near 'T'.
'E' is the third character of USE. 'T' is the third character of SET. I am not
sure the reason why? Please help.
I can execute uspSelectCount.sql in the SQLunit. <stmt>{call
uspSelectCount()}</stmt>
cwang
This is uspSelectCount.sql file
--------------------------------------------
USE [BillPay]
GO
/****** Object: StoredProcedure [dbo].[uspSelectCount] Script Date:
03/13/2008 15:51:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[uspSelectCount]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
Select count(*)
from dbo.Payments_Staging
End
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
Architect Keros http://sourceforge.net/projects/keros