[size=x-large]SQL实用技巧积累如下:[/size]
--1.查询某个数据库中总共有几张表
SELECT COUNT(id) AS COUNT FROM sysobjects s WHERE s.xtype='u'
--2.查询每张表对应的列的个数
SELECT S.NAME AS TableName,COUNT(C.ID) ColCount FROM syscolumns C
LEFT JOIN sysobjects S
ON C.id=S.id
WHERE S.xtype='u'
GROUP BY C.id,S.NAME