我想创建一个全文索引,但我不确定索引名称是否在所有数据库中都相同。所以,我打算编写下面的选择并获取索引的名称。
DECLARE @keyIndex NVARCHAR(100)
SELECT @keyIndex = name FROM sysobjects WHERE xtype = 'PK' AND parent_obj = OBJECT_ID(N'[dbo].[Table1]')
以下是我尝试过的全文索引的创建语句:
CREATE FULLTEXT INDEX ON dbo.Table1
(
[Name] Language 1033,
[Description] Language 1033
)
KEY INDEX [@keyIndex]
WITH STOPLIST = SYSTEM, CHANGE_TRACKING AUTO;
它给出了这个错误:
Msg 7653, Level 16, State 1, Line 11
'@keyIndex' is not a valid index to enforce a full-text search key. A full-text search key must be a unique, non-nullable, single-column index which is not offline, is not defined on a non-deterministic or imprecise nonpersisted computed column, does not have a filter, and has maximum size of 900 bytes. Choose another index for the full-text key.
我需要一些关于如何动态插入键索引值的帮助。