zoukankan      html  css  js  c++  java
  • 检查指定游标是否存在的函数.sql

    CREATE FUNCTION f_CursorExists(@CursorName sysname)
    RETURNS TABLE
    AS
    RETURN(
        SELECT * FROM(
            SELECT Name=@CursorName,
                Type=CAST('LOCAL' as varchar(8)),
                IsExists=CAST(CASE CURSOR_STATUS('LOCAL',@CursorName)
                    WHEN -3 THEN 0 ELSE 1 END as bit)
            UNION ALL
            SELECT @CursorName,'GLOBAL',
                CASE CURSOR_STATUS('GLOBAL',@CursorName) WHEN -3 THEN 0 ELSE 1 END
            UNION ALL
            SELECT @CursorName,'VARIABLE',
                CASE CURSOR_STATUS('VARIABLE',@CursorName) WHEN -3 THEN 0 ELSE 1 END
        )a WHERE IsExists=1)
    GO
  • 相关阅读:
    Hibernate
    Mysql
    JavaWeb
    Springboot
    spring MVC
    spring
    mybatis学习
    ftp客户端封装
    win10子系统 wsl开机启动ssh服务
    eclipse 终于官方支持代码模糊提示了
  • 原文地址:https://www.cnblogs.com/shihao/p/2532080.html
Copyright © 2011-2022 走看看