Hi all. I have this stored procedure which executes a lot of sql queries and returns the results. How do i go about returning only the results from the queries that returns rows?
BEGIN
DECLARE @Query varchar(4000)
DECLARE cur CURSOR FOR SELECT SQLSyntax FROM tblChecks
OPEN cur
FETCH NEXT FROM cur INTO @Query
WHILE @@FETCH_STATUS = 0 BEGIN
EXEC (@Query)
FETCH NEXT FROM cur INTO @Query
END
CLOSE cur
DEALLOCATE cur
END