sql server 检查表、存储过程是否存在

Sql Server 检查表、存储过程是否存在

  1. 检查表是否存在
select * from sysobjects where xtype = 'U' and name = 'table_name'
  1. 检查存储过程是否存在
select * from sysobjects where xtype = 'P' and name = 'procedure_name'
  1. 检查函数是否存在
select * from sysobjects where xtype = 'FN' and name = 'function_name'
  1. 检查视图是否存在
select * from sysobjects where xtype = 'V' and name = 'view_name'

你可能感兴趣的:(Sql,Service)