

| 如何得到一个数据库中每个表格的数据数目? | ★★★ | |
| 如何得到一个数据库中每个表格的数据数目? |
作者:不详 文章来源:中国论坛网 点击数: 更新时间:2005-5-10 ![]() |
|
USE pubs -- 可改成您的数据库名称 SET NOCOUNT ONDECLARE tables_cursor CURSOR FOR SELECT name FROM sysobjects WHERE type = U OPEN tables_cursor DECLARE @tablename varchar(30), @quote char(1) SELECT @quote = " FETCH NEXT FROM tables_cursor INTO @tablename WHILE (@@fetch_status <> -1) BEGIN EXEC ("Select " + @quote+"Rows in " + @tablename + " = "+ @quote + ", count(*) from "+ @tablename) FETCH NEXT FROM tables_cursor INTO @tablename END DEALLOCATE tables_cursor SET NOCOUNT OFF |
| 文章录入:残月 责任编辑:残月 |
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |