Tables which does not have identity column defined on it

Is there a way we can find the Tables that does not have identiy increment constraint defined on it's primary key colum ?
Who is Participating?
Anthony PerkinsConnect With a Mentor Commented:
Something like this:
SELECT	SCHEMA_NAME(t.schema_id),
FROM	sys.tables t
		SELECT	ic.object_id
		FROM	sys.identity_columns ic 
			INNER JOIN sys.key_constraints kc ON ic.object_id = kc.parent_object_id
		WHERE	kc.type = 'PK'
		) c ON t.object_id = c.object_id
WHERE c.object_id IS NULL

Open in new window

dumpalprAuthor Commented:
Thank you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.