SQL task - what is valid SQL to pass in?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Chris_McCafferty
Posted On:   Friday, May 3, 2002 07:47 AM

Hi, I'd like to automate the creation of a schema in a database and somewhere down the line I'd like to run automated tests against that schema (like, check the stored procedures work ok, retrurn sensible results). That way, if anything breaks we'll know in the nightly build. We're using Ant substantially in the project and I've tried to use the task to execute all our schema and sproc scripts. We're running against Sybase 11.9.2. A typical script is this: if exists(select name from sysobjects where name = "sp_CancelTrade") begin print "dropping old version of sp_CancelTrade" drop proc sp_CancelTrade end go prin   More>>

Hi,

I'd like to automate the creation of a schema in a database and somewhere down the line I'd like to run automated tests against that schema (like, check the stored procedures work ok, retrurn sensible results). That way, if anything breaks we'll know in the nightly build.


We're using Ant substantially in the project and I've tried to use the task to execute all our schema and sproc scripts. We're running against Sybase 11.9.2.


A typical script is this:


			
if exists(select name from sysobjects where name = "sp_CancelTrade")
begin
print "dropping old version of sp_CancelTrade"
drop proc sp_CancelTrade
end
go

print 'sp_CancelTrade'
SETUSER 'dbo'
go

create proc sp_CancelTrade
(
@TradeId dt_Id,
@Cancelled dt_Id
)
as

begin

update TradeAdjustEvents set

Cancelled = @Cancelled

Where Id = (select AdjustEventId from TradeCreationEvents where Id = @TradeId )

/* As a check, the EventTypeId of the event row we're cancelling should be 1 or whatever corresponds to a trade creation - @todo */

return 1

end

go

SETUSER
go

grant Execute on sp_CancelTrade to GRP_DUSK
go


grant Execute on sp_CancelTrade to GRP_Development
go


sp_procxmode 'sp_CancelTrade','anymode'
go



But unfortunately, this error is returned:


			
try-sql:
[sql] Executing commands
[sql] Failed to execute: if exists(select name from sysobjects where name = "sp_CancelTrade") begin print "droppin
g old version of sp_CancelTrade" drop proc sp_CancelTrade end

BUILD FAILED

O:ProjSPECTREEqFinanceDusksql uild.xml:21: com.sybase.jdbc2.jdbc.SybSQLException: The identifier that starts with
'"drop' is too long. Maximum length is 28.



Is this due to Ant's reliance on JDBC (and we're going beyond what JDBC can handle in our scripts)?


Are we better off going with a strategy of and using that to call isql, piping in the files like that?


Thanks,


Chris    <<Less

Re: SQL task - what is valid SQL to pass in?

Posted By:   Chris_McCafferty  
Posted On:   Friday, May 3, 2002 07:48 AM

By the way, I'm using Ant 1.4.1
About | Sitemap | Contact