all groups > sql server (alternate) > september 2004 >
You're in the

sql server (alternate)

group:

index questions


index questions rjngh2003 NO[at]SPAM sbcglobal.net
9/18/2004 7:50:21 AM
sql server (alternate):
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 ?


Re: index questions newbiegca_sqlserver2000
9/18/2004 3:20:53 PM


Thanks Gary

*** Sent via Developersdex http://www.developersdex.com ***
Re: index questions Garry
9/18/2004 6:00:05 PM
[quoted text, click to view]
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)

AddThis Social Bookmark Button