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