Live Insert Counts Without Disturbing Running Transaction
There are times long running insert transactions are annoying and we don’t get direct details of running transaction like how many rows inserted and how many are pending.
Following query gets estimated rows inserted for the specific table mentioned.
SELECT
TableName = t.NAME,
TableSchema = s.Name,
RowCounts = p.rows
FROM
sys.tables t
INNER JOIN
sys.schemas s ON t.schema_id = s.schema_id
INNER JOIN
sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN
sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
WHERE
t.is_ms_shipped = 0 and t.name=’Table Name’ — change table name
GROUP BY
t.NAME, s.Name, p.Rows
ORDER BY
s.Name, t.Name
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.
Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform
Swetha
Nice artical
sai
useful article