1.查询数据库中的所有数据库名: SELECT Name FROM Master..SysDatabases ORDER BY Name 2.查询某个数据库中所有的表名: SELECT Name FROM SysObjects Where XType='U' ORDER BY Name 3.查询表结构信息: 1 SELECT (case when a.colorder=1 then d.name else null end) 表名, 2 a.colorder 字段序号,a.name 字段名, 3…
1.查询数据库中的所有数据库名: SELECT Name FROM Master..SysDatabases ORDER BY Name 2.查询某个数据库中所有的表名: SELECT Name FROM SysObjects Where XType='U' ORDER BY Name 3.查询表结构信息: 1 SELECT (case when a.colorder=1 then d.name else null end) 表名, 2 a.colorder 字段序号,a.name 字段名, 3…
DECLARE @tablename VARCHAR(30),@sql VARCHAR(500)DECLARE cur_delete_table CURSOR READ_ONLY FORWARD_ONLY FORSELECT name FROM sysobjects WHERE name LIKE 'PUB%' AND type='U'OPEN cur_delete_tableFETCH NEXT FROM cur_delete_table INTO @tablenameWHILE @@FETC…