zoukankan      html  css  js  c++  java
  • 黄聪:sql server 判断系统中是否存在某个表,存储过程 或触发器

    存储过程

    if(exists(select * from sysobjects where name='存储过程的名字' and Type='P'))

    触发器:

      select * from sysobjects where id=object_id(N'触发器的名字') and objectproperty(id,N'IsTrigger')=1

    如果判断用户表格的话,用IsUserTable 代替 上面的IsTrigger

    函数

    select * from sysobjects where id = object_id(N'[dbo].[USER_Fun]') and (type = 'FN' or type = 'TF'))
    --判断是否存在USER_Fun这个用户函数(注意此处的type 有两种,分别是'TF'-Table-valued Function 表值函数 或'FN'-Scalar-valued Function 标量值函数)

  • 相关阅读:
    day58
    day57
    day55
    day56
    day54
    Vue(练习二)
    Vue练习
    Vue框架
    作业
    Django(九)
  • 原文地址:https://www.cnblogs.com/huangcong/p/1730231.html
Copyright © 2011-2022 走看看