Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help! sql script not running properly when run using and build script

1 view
Skip to first unread message

Ravi

unread,
Apr 28, 2008, 12:09:36 PM4/28/08
to
Dear all,

I have the following sql in a .sql file.

CREATE TABLE my_id_table (c_tag INT)
go

DECLARE @i INT
SELECT @i = 100
WHILE (@i <= 4000)
BEGIN
INSERT INTO my_id_table VALUES ( @i )
SELECT @i = @i + 1
END
go

This works perfectly when run on any sql tool like Sybase interactive
sql. But when run as part of a build using an ant build script this
only inserts up to about 31 records. I'm not getting any errors but
when I check the table after the script is executed, it is always
around 30.

I even tired running this using dbisql on a command prompt and it
worked fine.

Does anyone have any idea why this stops after about 30 inserts when
run using ant?

Alternatively is there any other way to populate numbers from 100 to
4000 on to this my_id_table static reference table?

Please help

Thank you
Ravi

Geoffrey

unread,
Apr 29, 2008, 10:13:12 AM4/29/08
to
Try this, it should work though still not super nice.

set rowcount 4000
select id = identity(10) into #test from <any big table with rowcount
greater than 4000>
delete #test where id < 100

Ravi

unread,
May 2, 2008, 7:10:44 AM5/2/08
to
Thank you very much Geoffrey for the tip.

By looking at it, it should definitely work and I also thought about
this at the beginning. But unfortunately I dont have any table that
large at the time of the build.

My script generally runs. It fails only when it is run using and build
script using ant sql task and SybaseSQLDriver. Even if I execute my
piece of SQL using any simple java program using JDBC it works.

So temporarily I settled with putting down separate Insert statements
instead of the loop and by including a 'go' after efvery 500th Insert.
Now it works. Even this failed when I tried do add all the Insert
statements in one go.

Thanks again for your tip.

Ravi

0 new messages