Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi everyoneI want to know if it's possible to do a for/while-loop so i can use INSERTLook:I've this int [] test = new test[140];But i need to insert for every value (140) a numberso normally it would be :
INSERT ... (case1, case2, case3 ...) value (test[1],test[2],test[3] ...)
But isn't there a way to it with a loop?SOmething Like this ?
for( int i = 0 , i< 140, i++) {INSERT case[i] value test[i]}
Thanks in advanceJonas
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-06-23 : 10:22:19
you can use WHILE loop.look for syntax in books online
sachinsamuel
Constraint Violating Yak Guru
383 Posts
Posted - 2008-06-23 : 10:24:36
Definitely yes. You can use while loop to achieve this.Check books online for more information on this.Don't sit back because of failure. It will come back to check if you still available. -- Binu
SwePeso
Patron Saint of Lost Yaks
30421 Posts
Posted - 2008-06-23 : 10:35:37
INSERT ... (case1, case2, case3 ...) value (test[1],test[2],test[3] ...)GO 50000will insert 50000 records for you.E 12°55'05.25"N 56°04'39.16"
jonas
Starting Member
6 Posts
Posted - 2008-06-23 : 10:40:02
where i find those books/tuts?i searched google and i didn't find =/Thanks for the replys
sachinsamuel
Constraint Violating Yak Guru
383 Posts
Posted - 2008-06-23 : 10:47:36
Books online comes with SQL Server installation.Don't sit back because of failure. It will come back to check if you still available. -- Binu
jonas
Starting Member
6 Posts
Posted - 2008-06-23 : 10:59:22
I searched abut 15 mins and i din't find anything that i cold use...Btw i this is sql with JAVA not with php or what everCould somebody tell me link or what i've to do ??Jonas