[SQL]プライマリキー(主キー)のインデックス ストレージ(ファイルグループ)を変更する

SQL Server

もととなるスクリプトを取得

Microsoft SQL Server Management Studio を使用

img_0


↓こんなのが出来上がる:

USE [TKAUCTION]
GO
/****** Object:
Index [T_CATEGORY_PK]
Script Date: 07/09/2011 00:03:14 ******/
ALTER TABLE [dbo].[T_category] ADD
CONSTRAINT [T_CATEGORY_PK] PRIMARY KEY CLUSTERED
(
[tkcategoryid] ASC
)WITH (PAD_INDEX
= OFF, STATISTICS_NORECOMPUTE
= OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS
= ON, ALLOW_PAGE_LOCKS
= ON) ON [Primary]
GO

以下のように書き換える

USE [TKAUCTION]
GO
/****** Object:
Index [T_CATEGORY_PK]
Script Date: 07/08/2011 23:56:24 ******/
CREATE UNIQUE CLUSTERED INDEX [T_CATEGORY_PK]
ON T_CATEGORY
(
[tkcategoryid] ASC
)WITH
(PAD_INDEX
= OFF,
DROP_EXISTING = ON,
STATISTICS_NORECOMPUTE
= OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS
= ON, ALLOW_PAGE_LOCKS
= ON) ON [INDEX]
GO

赤字の部分が追記,変更 箇所

コメント

スポンサーリンク
タイトルとURLをコピーしました