Monday, March 26, 2012

index questions

there are two types of indexes in microsoft sql server

a) clustered
b) non clustered

Question
can u create a primary key which is non clustered ?
If yes what is the syntax ?

Question

can u create a compound primary key and if yes what is the syntax ?

Please excuse me from asking basic questions ?> there are two types of indexes in microsoft sql server
> a) clustered
> b) non clustered
> Question
> can u create a primary key which is non clustered ?
> If yes what is the syntax ?
> Question
> can u create a compound primary key and if yes what is the syntax ?
>
> Please excuse me from asking basic questions ?
Yes, u can!

use tempdb
go
create table test (
tID int NOT NULL
,tText varchar(100) NOT NULL
)
ALTER TABLE test ADD
CONSTRAINT [test_PK] PRIMARY KEY NONCLUSTERED (tID)
CREATE CLUSTERED INDEX [IX_test_tText] ON [test] (tText)|||
Thanks Gary

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

No comments:

Post a Comment