查询数据库是否有该表名,查询数据库表是否有该列名

时间:2021-02-19 13:44:49

SQL Server:

查询表有没有该列:

 SELECT * FROM(  
 Select Name FROM SysColumns Where id=Object_Id(表名)  
 ) AS A 

 where A.name=列名

查询数据库有没有这个表:

       SELECT * FROM(  
    select * from sysobjects where xtype='U'
) AS A 

where A.name=表名

mysql和oracle可以组装:https://blog.****.net/sinat_32238399/article/details/79791555