TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
ObjectCount In Sql server
Akshay Phadke
Mar 24
2015
Code
765
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
select
'TABLE'
,
count
(*)
'TABLE COUNT'
from
sysobjects
WHERE
xtype=
'U'
UNION
ALL
select
'VIEW'
,
count
(*)
'TABLE COUNT'
from
sysobjects
WHERE
xtype=
'V'
UNION
ALL
select
'PROCEDURE'
,
count
(*)
'TABLE COUNT'
from
sysobjects
WHERE
xtype=
'P'
UNION
ALL
select
'FUNCTION'
,
count
(*)
'TABLE COUNT'
from
sysobjects
WHERE
xtype=
'FN'
UNION
ALL
SELECT
'INDEX'
,
count
(*)
'TABLE COUNT'
FROM
sys.indexes si
JOIN
sys.objects so
ON
si.object_id = so.object_id
WHERE
so.type =
'U'
AND
si.type <> 0
Join in SQL Server
ObjectCount
SQL Server