Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
scelamko
Constraint Violating Yak Guru
309 Posts |
Posted - 2008-10-03 : 09:15:43
|
Guys,Is there anyway to find in database given a column it has index or not.For example in all the 340 tables of the database on our instance I want to find out the instance where column 'EMPID' does not have any index.Also is there any to find all ID columns in the database which does not have Primary key constraint.Thanks |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-10-03 : 09:32:34
|
Tables without primary key----------------------------select * from information_schema.tableswhere table_type = 'base table'and objectproperty(object_id(table_name),'IsMsShipped') = 0and objectproperty(object_id(table_name),'TableHasPrimaryKey') = 0 |
 |
|
scelamko
Constraint Violating Yak Guru
309 Posts |
Posted - 2008-10-04 : 10:01:22
|
Thanks for the response Is there any way to find out if 'EMPID' column in all the database tables if it has an index or not. Different tables in the database are used to track specific information for employee and use 'EMPID' as an handle. All the queries and views use 'EMPID' as filter clause.Any suggestions and inputs would helpThanks |
 |
|
|
|
|