May 6, 2009 at 12:22 am
Hi all,
I have a store procedure that generates this dynamic output
Execute generate_email '1'; Execute generate_email '9';
which i would like to execute them in at once. how do you do this?
I am trying to avoid cursor here so I tried going into concatenating all those execute statements into a string and execute them at the same time. is this possible?
May 6, 2009 at 4:46 am
Hi
I'm not sure if I got you, but try this:
CREATE PROCEDURE usp_TestPrint
@text NVARCHAR(128)
AS
PRINT @text
GO
DECLARE @sql NVARCHAR(MAX)
SELECT TOP(10)
@sql = ISNULL(@sql, '') + CHAR(10) + N'EXECUTE usp_TestPrint ''' + name + ''''
FROM sys.objects
EXECUTE (@sql)
Greets
Flo
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply