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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Are Indexes created by default??

Author  Topic 

Will H
Yak Posting Veteran

56 Posts

Posted - 2007-11-15 : 12:35:54
Silly question - I create a new table w/ a primary key. Based on querying sys.indexes, it looks like a Clustered Index is created by default. Is this a correct assumption???

If I wanted to turn off the default index creation (say, because I'm a control freak and want to name all my indexes) how would I do this??

---------------------------------------------------------
SSRS Kills Kittens.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-11-15 : 12:52:16
You always get an index with a primary key constraint. The default is for it to be clustered. You could specify non-clustered though.

You can't turn off the automatic creation of an index on a PK constraint. The index will have the same name as the constraint which is typically PK_TableName.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-11-15 : 12:54:35
i guess you can always rename it with sp_rename

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

Will H
Yak Posting Veteran

56 Posts

Posted - 2007-11-15 : 13:02:43
Perfect, thanks all!

---------------------------------------------------------
SSRS Kills Kittens.
Go to Top of Page
   

- Advertisement -