Thursday, April 10, 2008

Using Index



select *from ZIPCodes where StateName = ‘New York’

Create Index
create nonclustered index idxStateName on ZIPCodes(StateName)
create nonclustered index idxZIPType on ZIPCodes(ZIPType)

Use Index
select *from ZIPCodes with(INDEX(idxZIPType)) where ZIPType = ‘S’

– List of Indexes on Perticular Table
exec sp_helpindex ‘ps_client_master’

Drop Index
drop index ps_client_master.ps_client_master_Index_1

No comments: