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.
I'm trying to add a new value for each row in my database, im very new to sql server. can anyone explain why this wont work and offer a possible solution please. TYIA
counter = '0'start:if counter=957 begin goto the_end; endelse begin select set price = (round((rnd * 600) + 1)) counter+=1 goto start; endthe_end:select price, * from stock
whats the purpose of loop? cant you go for batch update? are you just trying to random update some records?
elev8
Starting Member
4 Posts
Posted - 2008-12-17 : 01:54:44
On the contrary, I was trying to update each row with some random numbers. I had previously set them, all to zero without backing up.
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-12-17 : 02:03:13
quote:Originally posted by elev8 On the contrary, I was trying to update each row with some random numbers. I had previously set them, all to zero without backing up.
even then wats the purpose of loop? cant you just fire a batch update on all records with value 0 with random number?