sqlserver能不能用sql语句来判断数据库里有多少表,判断某个表是否存在呢?如果不能请大侠们给点好方法!
非常感谢@!!!
------解决方案--------------------
- SQL code
if exists (select 1 from sysobjects where name = '表名' and xtype = 'p')print 存在
------解决方案--------------------
- SQL code
select count(1) from sysobjects where xtype='U'if object_id('表名') is not nullprint '有'else print '沒'
------解决方案--------------------
- SQL code
--1sql语句来判断数据库里有多少表select count(*) from sys.tables--2if object_id('数据库.架构.表') is not nullprint '存在'elseprint '不存在'
------解决方案--------------------
------解决方案--------------------