Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE dbo.p_cleanUpCursor @cursorName varchar(255) AS
- BEGIN
- DECLARE @cursorStatus int
- SET @cursorStatus = (SELECT cursor_status('global',@cursorName))
- DECLARE @sql varchar(255)
- SET @sql = ''
- IF @cursorStatus > 0
- SET @sql = 'CLOSE '+@cursorName
- IF @cursorStatus > -3
- SET @sql = @sql+' DEALLOCATE '+@cursorName
- IF @sql <> ''
- exec(@sql)
- END
Add Comment
Please, Sign In to add comment