书上的操作是:1.打开SQL Server Enterprise Manager窗口,展开SQL Server Enterprise Manager窗口的相关结构.单击响应数据库下的"Table"选项,使SQL Server Enterprise Manager窗口右窗格显示该数据库的数据表名.右键单击SQL Server Enterprise Manager窗口右窗格中需要创建全文索引的表名,弹出快捷菜单.
zsx919(某某某)大哥,我按照你的方法作了,但还是不行,请你说的详细点
示例 A. 使用简单索引 下面的示例为 authors 表的 au_id 列创建索引。SET NOCOUNT OFF USE pubs IF EXISTS (SELECT name FROM sysindexes WHERE name = 'au_id_ind') DROP INDEX authors.au_id_ind GO USE pubs CREATE INDEX au_id_ind ON authors (au_id) GOB. 使用唯一聚集索引 下面的示例为 emp_pay 表的 employeeID 列创建索引,并且强制唯一性。因为指定了 CLUSTERED 子句,所以该索引将对磁盘上的数据进行物理排序。 SET NOCOUNT ON USE pubs IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'emp_pay') DROP TABLE emp_pay GO USE pubs IF EXISTS (SELECT name FROM sysindexes WHERE name = 'employeeID_ind') DROP INDEX emp_pay.employeeID_ind GO USE pubs GO CREATE TABLE emp_pay ( employeeID int NOT NULL, base_pay money NOT NULL, commission decimal(2, 2) NOT NULL ) INSERT emp_pay VALUES (1, 500, .10) INSERT emp_pay VALUES (2, 1000, .05) INSERT emp_pay VALUES (3, 800, .07) INSERT emp_pay VALUES (5, 1500, .03) INSERT emp_pay VALUES (9, 750, .06) GO SET NOCOUNT OFF CREATE UNIQUE CLUSTERED INDEX employeeID_ind ON emp_pay (employeeID) GOC. 使用简单组合索引 下面的示例为 order_emp 表的 orderID 列和 employeeID 列创建索引。SET NOCOUNT ON USE pubs IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'order_emp') DROP TABLE order_emp GO USE pubs IF EXISTS (SELECT name FROM sysindexes WHERE name = 'emp_order_ind') DROP INDEX order_emp.emp_order_ind GO USE pubs GO CREATE TABLE order_emp ( orderID int IDENTITY(1000, 1), employeeID int NOT NULL, orderdate datetime NOT NULL DEFAULT GETDATE(), orderamount money NOT NULL )INSERT order_emp (employeeID, orderdate, orderamount) VALUES (5, '4/12/98', 315.19) INSERT order_emp (employeeID, orderdate, orderamount) VALUES (5, '5/30/98', 1929.04) INSERT order_emp (employeeID, orderdate, orderamount) VALUES (1, '1/03/98', 2039.82) INSERT order_emp (employeeID, orderdate, orderamount) VALUES (1, '1/22/98', 445.29) INSERT order_emp (employeeID, orderdate, orderamount) VALUES (4, '4/05/98', 689.39) INSERT order_emp (employeeID, orderdate, orderamount) VALUES (7, '3/21/98', 1598.23) INSERT order_emp (employeeID, orderdate, orderamount) VALUES (7, '3/21/98', 445.77) INSERT order_emp (employeeID, orderdate, orderamount) VALUES (7, '3/22/98', 2178.98) GO SET NOCOUNT OFF CREATE INDEX emp_order_ind ON order_emp (orderID, employeeID)
A. 使用简单索引
下面的示例为 authors 表的 au_id 列创建索引。SET NOCOUNT OFF
USE pubs
IF EXISTS (SELECT name FROM sysindexes
WHERE name = 'au_id_ind')
DROP INDEX authors.au_id_ind
GO
USE pubs
CREATE INDEX au_id_ind
ON authors (au_id)
GOB. 使用唯一聚集索引
下面的示例为 emp_pay 表的 employeeID 列创建索引,并且强制唯一性。因为指定了 CLUSTERED 子句,所以该索引将对磁盘上的数据进行物理排序。 SET NOCOUNT ON
USE pubs
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'emp_pay')
DROP TABLE emp_pay
GO
USE pubs
IF EXISTS (SELECT name FROM sysindexes
WHERE name = 'employeeID_ind')
DROP INDEX emp_pay.employeeID_ind
GO
USE pubs
GO
CREATE TABLE emp_pay
(
employeeID int NOT NULL,
base_pay money NOT NULL,
commission decimal(2, 2) NOT NULL
)
INSERT emp_pay
VALUES (1, 500, .10)
INSERT emp_pay
VALUES (2, 1000, .05)
INSERT emp_pay
VALUES (3, 800, .07)
INSERT emp_pay
VALUES (5, 1500, .03)
INSERT emp_pay
VALUES (9, 750, .06)
GO
SET NOCOUNT OFF
CREATE UNIQUE CLUSTERED INDEX employeeID_ind
ON emp_pay (employeeID)
GOC. 使用简单组合索引
下面的示例为 order_emp 表的 orderID 列和 employeeID 列创建索引。SET NOCOUNT ON
USE pubs
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'order_emp')
DROP TABLE order_emp
GO
USE pubs
IF EXISTS (SELECT name FROM sysindexes
WHERE name = 'emp_order_ind')
DROP INDEX order_emp.emp_order_ind
GO
USE pubs
GO
CREATE TABLE order_emp
(
orderID int IDENTITY(1000, 1),
employeeID int NOT NULL,
orderdate datetime NOT NULL DEFAULT GETDATE(),
orderamount money NOT NULL
)INSERT order_emp (employeeID, orderdate, orderamount)
VALUES (5, '4/12/98', 315.19)
INSERT order_emp (employeeID, orderdate, orderamount)
VALUES (5, '5/30/98', 1929.04)
INSERT order_emp (employeeID, orderdate, orderamount)
VALUES (1, '1/03/98', 2039.82)
INSERT order_emp (employeeID, orderdate, orderamount)
VALUES (1, '1/22/98', 445.29)
INSERT order_emp (employeeID, orderdate, orderamount)
VALUES (4, '4/05/98', 689.39)
INSERT order_emp (employeeID, orderdate, orderamount)
VALUES (7, '3/21/98', 1598.23)
INSERT order_emp (employeeID, orderdate, orderamount)
VALUES (7, '3/21/98', 445.77)
INSERT order_emp (employeeID, orderdate, orderamount)
VALUES (7, '3/22/98', 2178.98)
GO
SET NOCOUNT OFF
CREATE INDEX emp_order_ind
ON order_emp (orderID, employeeID)