Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie question on creating index
Message
General information
Forum:
Microsoft SQL Server
Category:
Database design
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01243713
Message ID:
01243872
Views:
21
>>>1. I want to create a couple of index keys for a table. At this point I want to learn how to do it using SQL Server Management Studio, visually. I opened SQLSMS, go to my database, to the table. Then I clicked on Table Designer menu and on the Indexes/Keys item. The Indexes/Keys window is empty. And I thought I would see at least on index key there, for the Primary key (as I read in the BOL that SQL Server automatically creates a clustered index for a Primary key in a table). If not in this window, where do you see the clustered index keys (that are automatically created by SQL Server)?
>>
>>All fields involved in PK are marked with key icon in the grid. Did you see such things?
>>To see ALL indexes you could script the table, Right Click on Table name in TreeView and select Script Table as CREATE To.
>>
>
>It shows you I don't know much about SQl Server indexes (and other things too) <g>.
>
>First, about Primary key. I am not sure I have one. When I created a table I set property of one of the columns as Identity Specification to Yes. I thought this automatically makes the column as Primary. Am I mistaken? If so, how do you do it?

No, SQL Server didn't make that column PK automatically. It is just another column in your table. To make it PK just select the row where it is defined 9open table designer and press the square left of the field name) then press Set primary key button (that with key icon in it).

>When I script the table to a Query (as you suggested) the CREATE TABLE expression shows columns of the table, shows one column as IDENTITY and no indexes. Where would I see the "key icon in the grid"? I see no grid anywhere.

Right click on the Table name in TreeView and choose Modify. If no new toolbar appears go to View->Toolbars and check on table Designer. In that toolbar you must have a button with a key icon :-)
If you have some PRIMARY index the Key icon should appear in the same grey (or whatever theme your have) place at left oif the field name.



> Sorry for being so newbie on this.

Aren't we all being there, so don't be.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform