select [name] from [TPMS_PRD].[dbo].sysobjects where id in(select id from [TPMS_PRD].[dbo].syscolumns Where name='supplierid') 包含SupplierId这个字段的所有表 格式如下: select [name] from [库名].[dbo].sysobjects where id in(select id from [库名].[dbo].syscolumns Where…
1.查询包含某字段的所有表 select object_name(id) objName,Name as colName from syscolumns where (name like'%你要查询的字段名%') and id in(select id from sysobjects where xtype='u') order by objname ; 2.查询包含某字段的所有存储过程 SELECT obj.Name 存储过程名, sc.TEXT 存储过程内容 FROM syscomments…
--查询tablename 数据库中 以"_copy" 结尾的表 select table_name from information_schema.tables where table_schema='tablename' and table_type='base table' and table_name like '%_copy'; --information_schema 是MySQL系统自带的数据库,提供了对数据库元数据的访问 --information_schema.tab…
我们有时候会需要查询数据库中包含某字段的所有的表,去进行update,这时就可以用下面的SQL来实现: select object_name(id) objName,Name as colName from syscolumns where (name like'%此次写需要查询的字段名称%')and id in(select id from sysobjects where xtype='u')order by objname; 当然也可以使用游标,把查询出来的Table串接起来,如下: DE…
查询tablename 数据库中 以"_copy" 结尾的表 select table_name from information_schema.tables where table_schema='tablename' and table_type='base table' and table_name like '%_copy'; information_schema 是MySQL系统自带的数据库,提供了对数据库元数据的访问information_schema.tables 指数据…
SELECT TABLE_NAME '表名',TABLE_SCHEMA '数据库名',ORDINAL_POSITION '顺序',COLUMN_NAME '字段',DATA_TYPE '类型' ,CHARACTER_OCTET_LENGTH '字节长',IF(COLUMN_KEY='PRI',"√","") '主键',IF(EXTRA='auto_increment',"√","") '自增长' ,IF(IS_NULLABLE…
CREATE TABLE itemdata_LANG ( itemno ) NOT NULL, itemname ), -- 产品名称 othername ), indications ), -- 适用范围 principle ), -- 工作原理 faultanalysis ), -- 故障分析 faults ), -- 常见故障 instalsite ), -- 安装位置 manufact ), -- 生产厂家 brand ), -- 品牌名称 chandi ), -- 产地 newRema…
存储过程太多,有时只记得存储过程里面的某一点类容,想要找到对应的存储过程: SELECT obj.Name 存储过程名, sc.TEXT 存储过程内容 FROM syscomments sc INNER JOIN sysobjects obj ON sc.Id = obj.ID WHERE sc.TEXT LIKE '%自己要查的内容%'…
and c.relnamespace = n.oid and nspname = 'public' and a.atttypid = t.oid and typname = 'TEXT' and c.relkind = 'r';…
场景:查询DNMes数据库中所有包含RFID字段的表名 sql语句: select object_name(id) objName,Name as colName from syscolumns where (name like'%此次写需要查询的字段名称%') and id in(select id from sysobjects where xtype='u') order by objname 测试查询sql语句: select object_name(id) objName,Name a…