查询表是否存在:
表名:“BookHotelInfo”, type = 'u'
select * from sysobjects where id = object_id('BookHotelInfo') and type = 'u'
select * from sys.tables where name='BookHotelInfo' and type = 'u'
查询字段是否存在:
表名:“BookHotelInfo”, 字段名“RoomType”
select * from syscolumns where name='RoomType' and objectproperty(id,'IsUserTable')=1 and object_name(id)='BookHotelInfo'
Oracle查询表是否存在:
select count(*) from tabs where table_name ='表名' 返回一个数字 , 0 或者 1 ;
本文介绍如何使用SQL查询特定表及字段是否存在于数据库中,包括针对不同类型的数据库(如SQL Server和Oracle)的方法。提供了具体的SQL语句示例,帮助读者了解如何检查表‘BookHotelInfo’及其字段‘RoomType’的存在性。
3337

被折叠的 条评论
为什么被折叠?



