sql中创建主键非聚集索引和聚集索引

--排序(聚集索引)
create clustered index inx_entry_stock_bi on entry_stock_d(entry_stock_bi)

--创建非聚集索引

create nonclustered index inx_entry_stock_on entry_stock_d(entry_stock_bi)

--主键
alter table entry_stock_d add primary key nonclustered--主键且非聚集
(
 entry_stock_bi,aid
)


 select * from sysobjects where parent_obj in(select id from sysobjects where xtype='U' and name='saleticket_currency_d')
alter table saleticket_currency_d drop constraint PK__saleticket_curre__1F8E9120
alter table saleticket_currency_d alter column card_id  varchar(20) not null
alter table saleticket_currency_d add constraint PK__saleticket_curre__1F8E9120 primary key nonclustered(saleticket_bi,currency_id,card_id)

 

 

create clustered index  pk__tb_d_seq  on tb_d(tab_id,seq)


posted @ 2007-09-24 14:52  kuailewangzi1212  阅读(1770)  评论(0编辑  收藏  举报