TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Thomas
NA
41
0
Stored procedure - Only return if rows > 0
Jun 22 2017 10:23 AM
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
Reply
Answers (
7
)
append dynamic where condition inside sp
Regarding data type