DECLARE @1 TABLE (Startcnt1 BIGINT, Startcnt2 BIGINT,Startcnt3 BIGINT, Secondcnt1 BIGINT, Secondcnt2 BIGINT, Secondcnt3 BIGINT)
INSERT INTO @1
( Startcnt1 ,
Startcnt2 ,
Startcnt3
)
SELECT
(SELECT COUNT(1) FROM Table1),
(SELECT COUNT(1) FROM Table2),
(SELECT COUNT(1) FROM Table3)
WAITFOR DELAY '00:01'
UPDATE @1
SET Secondcnt1 = (SELECT COUNT(1) FROM Table1)
UPDATE @1
SET Secondcnt2 = (SELECT COUNT(1) FROM Table2)
UPDATE @1
SET Secondcnt3 = (SELECT COUNT(1) FROM Table3)
SELECT Startcnt1 ,
Secondcnt1 ,
Secondcnt1 -Startcnt1 ChangeCnt1,
Startcnt2 ,
Secondcnt2 ,
Secondcnt2 - Startcnt2 ChangeCnt2,
Startcnt3 ,
Secondcnt3 ,
Secondcnt3 - Startcnt3 ChangeCnt3
FROM @1
No comments:
Post a Comment