select d.name as 表名,COUNT (*)as 記錄 from syscolumns a inner join sysobjects d on a.id = d.id and d.xtype = 'U'
成都創(chuàng)新互聯(lián)公司主營禹城網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,成都App制作,禹城h5小程序定制開發(fā)搭建,禹城網(wǎng)站營銷推廣歡迎禹城等地區(qū)企業(yè)咨詢
group by d.name
這是sqlserver 實現(xiàn)的,不知道符不符合。不過剛剛驗證了一下,不是很對,估計是主鍵的原因,修改好了再看看
以上語句只能測試出部分,這個存儲過程可以實現(xiàn)全部,sqlserver直接執(zhí)行即可:
create table #temp(Recordcount int ,tableName varchar(30))
declare @tablename varchar(30)
declare @sql varchar(100)
declare @str varchar(30)
declare tablecursor cursor for
select name from sysobjects where xtype='u'
open tablecursor
fetch next from tablecursor into @tablename
while @@fetch_status=0
begin
set @str=@tablename
set @sql='insert into #temp(recordcount,tablename) select count(*),'+''''+@tablename+''''+' from '+@tablename
exec(@sql)
fetch next from tablecursor into @tablename
end
close tablecursor
deallocate tablecursor
select * from #temp drop table #temp
嗨!這個跟很多條件有關(guān)的! 比如存儲跨盤面造成緩慢
--------------------------------------------------
不說廢話,看SQL,你看那個好就用那個,99.9%的情況下是第二種快!
SET STATISTICS TIME on
select count(*) from dbo.Order_Detail where detail_ID is not null;
SET STATISTICS TIME off
SET STATISTICS TIME on
select rowcnt from dbo.sysindexes where id=object_id('Order_Detail') and indid=1
SET STATISTICS TIME off
----------------------------------------------------------
你的1000萬,我的也不少!時間30ms,第二種 2ms
可以通過全局變量@@rowcount來獲得
如
create PROCEDURE table111
as
begin
DECLARE @sqltxt nvarchar(4000),@row integer
set @sqltxt='delete from table where id=2'
exec(@sqltxt)
set @row = @@rowcount --執(zhí)行完后保存受影響的行數(shù)至變量
SQL Server 是一個全面的、集成的、端到端的數(shù)據(jù)解決方案,它為組織中的用戶提供了一個更安全可靠和更高效的平臺用于企業(yè)數(shù)據(jù)和 BI 應(yīng)用。
SQL Server 2005 為 IT 專家和信息工作者帶來了強(qiáng)大的、熟悉的工具,同時降低了在從移動設(shè)備到企業(yè)數(shù)據(jù)系統(tǒng)的多平臺上創(chuàng)建、部署、管理和使用企業(yè)數(shù)據(jù)和分析應(yīng)用程序的復(fù)雜性。
1、以數(shù)據(jù)庫text為例:
USE text
go
SELECT ?A.NAME,MaxRows = MAX(B.rows)
FROM sys.tables A
INNER JOIN sys.partitions B?ON A.object_id = B.object_id
GROUP BY A.name
ORDER BY MAX(B.rows) DESC?- -按數(shù)據(jù)行數(shù)的降序進(jìn)行排序顯示
2、顯示所有空表
USE text
go
SELECT ?A.NAME,MaxRows = MAX(B.rows)
FROM sys.tables A
INNER JOIN sys.partitions B?ON A.object_id = B.object_id
GROUP BY A.name
HAVING MAX(B.rows) = 0
3、顯示所有非空表
USE text
go
SELECT ?A.NAME,MaxRows = MAX(B.rows)
FROM sys.tables A
INNER JOIN sys.partitions B?ON A.object_id = B.object_id
GROUP BY A.name
HAVING MAX(B.rows) 0
在SQL
server2000中,一個數(shù)據(jù)庫中最多可以創(chuàng)建20億個表,每個表最多可以定義1024個列(字段),每行最多可以存儲8060字節(jié),表的行數(shù)及總大小僅受可用存儲空間的限制。
當(dāng)前名稱:sqlserver行數(shù),sql行數(shù)怎么看
分享鏈接:http://vcdvsql.cn/article8/dsieeop.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、定制開發(fā)、、網(wǎng)站建設(shè)、網(wǎng)站營銷、靜態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)