Sample Header Ad - 728x90

SQL Server Cursor preceed by IF statement?

-1 votes
1 answer
264 views
The SELECT statement to populate my Sql Server CURSOR can (often) return zero rows. Is it advisable to enclose it within an IF check so the CURSOR it is not Declared, Opened, Closed, & Deallocated ? Or will the RDMS automatically know not to create the CURSOR and/or does an IF based on the exact same SELECT infer the query processing twice?
Asked by M S (21 rep)
Aug 31, 2023, 12:26 AM
Last activity: Aug 31, 2023, 12:46 PM