Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. create function [dbo].[FastCount](@object_id int)
  2. returns bigint
  3. as
  4. begin
  5. declare @fastcount bigint = 0
  6.  
  7. select @fastcount = sum (p.rows)
  8. from sys.tables as t
  9. inner join sys.partitions as p on p.object_id = t.object_id
  10. where p.index_id < 2
  11. and t.object_id = @object_id
  12.  
  13. return @fastcount
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement