August 6, 2009 at 8:11 am
August 6, 2009 at 8:18 am
Yes, I am calling another stored procedure from within a stored procedure. I can't actually run any of the updates and inserts at this point so can't do print. Though will check it out.
So would I do the below: (new material added in italics)
update1
set @value = @@rowcount
exec dbo.storedprocedure @value
set @value = 0.0
update2
set @value = @@rowcount
exec dbo.storedprocedure @value
set @value = 0.0
insert1
set @value = @@rowcount
exec dbo.storedprocedure @value
set @value = 0.0
insert2
set @value = @@rowcount
exec dbo.storedprocedure @value
set @value = 0.0
insert3
set @value = @@rowcount
exec dbo.storedprocedure @value
set @value = 0.0
update3
set @value = @@rowcount
exec dbo.storedprocedure @value
set @value = 0.0
--
:hehe:
August 6, 2009 at 8:23 am
August 6, 2009 at 8:28 am
ta.bu.shi.da.yu (8/6/2009)
No need to.Just run:
set @value = 3
exec dbo.dummystoredprocedure @value
print @value
where dummystoredprocedure has some sort of NOP (e.g. select 1).
You'll see that the value after the exec doesn't change.
Meaning I need to reset it by doing set @value = 0.0, correct ?
I want the value to change (in other words reset) because I want to pass the count of each insert / update seperately.
--
:hehe:
August 6, 2009 at 8:36 am
never mind. problem solved, dont need to initialize it, maybe Lynn meant something else and i confused it. sorry for the hi-jack.
--
:hehe:
August 12, 2009 at 2:15 am
Hi,
Instead u can use while loop.. which will solve the problem
Thanks and Regards
Shyamala Shankar Raman
August 12, 2009 at 2:30 am
Shyamala Shankar Raman (8/12/2009)
Instead u can use while loop.. which will solve the problem
Sure it will, you would only have to wait longer.
While loops are no better than cursors on the performance side. They can be even worse than cursors when the number of rows in the table exceeds a critical edge.
I wouldn't go that way.
-- Gianluca Sartori
August 12, 2009 at 6:54 am
Gianluca Sartori (8/12/2009)
Shyamala Shankar Raman (8/12/2009)
Instead u can use while loop.. which will solve the problemSure it will, you would only have to wait longer.
While loops are no better than cursors on the performance side. They can be even worse than cursors when the number of rows in the table exceeds a critical edge.
I wouldn't go that way.
I agree... I'd rewrite the code so it wouldn't call a proc on a RBAR basis. Too many people justify a loop by saying "I need it to run this stored procedure one row at a time." That's just not the correct justification.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 8 posts - 16 through 22 (of 22 total)
You must be logged in to reply to this topic. Login to reply