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