Google Mobile Ads

Wednesday, April 17, 2013

SQL'de bir tabloya index ekleme ve bu eklenen index'e göre tabloyu rebuild etme


Bir tabloya index ekleme ve bu eklenen index'e göre tabloyu rebuild etme

IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[t_Products]') AND name = N'x_Products_venderno')
DROP INDEX [x_Products_venderno] ON [dbo].[t_Products] WITH ( ONLINE = OFF )
GO

CREATE NONCLUSTERED INDEX [x_Products_venderno] ON [dbo].[t_Products] 
(
[ds_id] ASC,
[vender_no] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO


ALTER INDEX x_Products_venderno ON [dbo].[t_Products]
REBUILD;

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...