Thursday, December 17, 2009

Determine Tables w/o a PK

How to determine which tables in a database do not have a primary key. Needed this for a replication rollout.


SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
EXCEPT
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE CONSTRAINT_TYPE = 'PRIMARY KEY'

Friday, April 3, 2009

Woohoo! Back from the dead, and I'm not even a zombie... well, maybe a little. :)

New job - same technologies though - C# and SQL for the most part. Will post more later.