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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Can somebody help me with this!!!

Author  Topic 

Nitu
Yak Posting Veteran

81 Posts

Posted - 2006-03-09 : 15:44:04
Here is example of what i want to do.

select @fieldCount = Count(@field1) from table1 where field2 = @variablepassed_to_sp

"lets say table1 has 6 rows for the condition
field2 = @variablepassed_to_sp"

now i want to process each row,
set @i = 1
while @i <= @fieldCount

select @tempVar(i) = field1 from table1 where field2 = @variablepassed_to_sp

select field3, field6 from table2 where field4 = @tempvar(i)

if field3 <> field6
call procedure3
else
call procedure4
set @i = @i + 1

Can you give me a sample code to do the above.

Thanks a lot in advance,
Nitu

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-03-09 : 17:15:40
Can you explain what you're trying to do, rather than the way you've chosen to tackle it?

There is probably a much simpler solution to this problem.

Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-03-09 : 18:18:00
Duplicate:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=63012

Please post any question on the original thread.

CODO ERGO SUM
Go to Top of Page
   

- Advertisement -