I'm using SQL Server 2012 and I have a statement that runs a stored procedure:
SELECT TOP(10)
'exec dbo.PurgeResults '''+ Description + ''',''' + CONVERT(VARCHAR, DATEADD(dd,-30,GetDate()), 101) + ''''
FROM
Alerts
The result I get is like this but there's a lot.
exec dbo.PurgeResults '127 - PM_Sanitation','09/03/2018'
How do I turn that statement I have to run the exec inside the result? I'm not sure if I am phasing it correctly.
execcommand as a string which is an output from select query