create function getallempname() returns varchar(5000) begin declare sri cursor for ( select * from sep) for read only declare @ename1 varchar(5000) declare @ename2 varchar(100) open sri fetch next from sri into @ename2 select @ename1='' while @@fetch_status=0 begin select @ename1=@ename1+','+@ename2 fetch next from sri into @ename2 end return @ename1 end
alter
function getbccmail()
returns varchar(5000)
begin declare cur_mail cursor for ( select bu.business_email from business_users bu where bu.business_activity_status='activated' ) for read only declare @bccmai varchar(5000) declare @bccmail varchar(100) open cur_mail fetch next from cur_mail into @bccmail select @bccmai='' while @@fetch_status = 0 begin select @bccmai =@bccmai+ ','+ @bccmail fetch next from cur_mail into @bccmail end return(@bccmai) end