SQLTeam.com | Weblogs | Forums

Using Conditional loops from the results of a stored procedures


#1

Hi,
I want to run a stored procedure and if it returns counts (which is what it does), I want to run another stored procedure if not I just want it to return a message that there are not results today. I know that I would run a SQL task to start store the results in a variable, and that I would need a conditional loop but I am not sure how to connect these and all that I would need here.
Does someone have an example or know where I can go to get one.
Thanks


#2

create proc proc1
as
set nocount on;

declare @count int;

select @count = count(*) from table1;

if @count > 1
exec proc2;
else
select 'No results today.';


#3

Hi,
That works, Thanks
I was hoping to see how to do this part in SSIS though, but that will work.
Thank you
itm