MyBusinessという1つのテーブルに対して2つのビューを作成しましたが、2つのビューの目的は未承認のすべてのビジネスを表示することです&堅牢な検索機能。これが私がフルテキストカタログを利用した理由です。SQLフルテキストカタログの表示
私のテーブルの構造:
USE [MyDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MyBusiness](
[MyBusinessID] [uniqueidentifier] NOT NULL CONSTRAINT [DF_MyBusiness_MyBusinessID] DEFAULT (newid()),
[MyBusinessDateCreated] [datetime] NOT NULL CONSTRAINT [DF_MyBusiness_MyBusinessDateCreated] DEFAULT (getdate()),
[MyBusinessActive] [bit] NOT NULL CONSTRAINT [DF_MyBusiness_MyBusinessActive] DEFAULT ((1)),
[MyBusinessContactPersonName] [varchar](max) NULL,
[MyBusinessCompanyName] [varchar](max) NULL,
[MyBusinessContactNumber] [varchar](max) NULL,
[MyBusinessEmail] [varchar](max) NULL,
[MyBusinessDescription] [varchar](max) NULL,
[MyBusinessWebPage] [varchar](max) NULL,
[MyBusinessAddress] [varchar](max) NULL,
[MyBusinessSpecialty] [varchar](max) NULL,
[MyBusinessTwitter] [varchar](max) NULL,
[MyBusinessFacebook] [varchar](max) NULL,
[MyBusinessImageURL] [varchar](max) NULL,
[MyBusinessApproved] [bit] NULL CONSTRAINT [DF_MyBusiness_MyBusinessApproved] DEFAULT ((0)),
[MyBusinessGmapLat] [varchar](max) NULL,
[MyBusinessGmapLong] [varchar](max) NULL,
[UserID] [nvarchar](128) NULL,
[ServiceURL] [varchar](max) NULL,
[EditURL] [varchar](max) NULL,
[DeleteURL] [varchar](max) NULL,
CONSTRAINT [PK_MyBusiness] PRIMARY KEY CLUSTERED
(
[MyBusinessID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
承認されたビジネスのためのマイビュー:
USE [MyDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[vwApprovedBusiness]
WITH SCHEMABINDING
AS
SELECT
mb.MyBusinessID,
mb.MyBusinessDateCreated,
mb.MyBusinessActive,
mb.MyBusinessContactPersonName,
mb.MyBusinessCompanyName,
mb.MyBusinessContactNumber,
mb.MyBusinessEmail,
mb.MyBusinessDescription,
mb.MyBusinessWebPage,
mb.MyBusinessAddress,
mb.MyBusinessSpecialty,
mb.MyBusinessTwitter,
mb.MyBusinessFacebook,
mb.MyBusinessImageURL,
mb.MyBusinessApproved,
mb.MyBusinessGmapLat,
mb.MyBusinessGmapLong,
mb.UserID,
mbs.MyBusinessServiceType,
mb.ServiceURL
FROM dbo.MyBusiness AS mb
INNER JOIN dbo.MyBusinessService AS mbs ON mbs.MyBusinessID = mb.MyBusinessID
WHERE (mb.MyBusinessApproved = 1)
GO
私は私のフルテキストカタログを追加できるように、私はMyBusinessIDの列に一意のインデックスを作成しました:
USE [MyDB]
GO
SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET NUMERIC_ROUNDABORT OFF
GO
CREATE UNIQUE CLUSTERED INDEX [IDX_V1] ON [dbo].[vwApprovedBusiness]
(
[MyBusinessID] 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)
GO
私は次に全文を追加カタログ:
USE [MyDB]
GO
CREATE FULLTEXT CATALOG [fiApprovedBusiness]WITH ACCENT_SENSITIVITY = OFF
AS DEFAULT
GO
私は
UPDATE [MyDB].[dbo].[MyBusiness] SET MyBusinessApproved = 1 where MybusinessID = '97AC226D-E58A-470A-A553-7C4A73551038'
を承認事業を更新し、1(真)に設定したいたびに私を取得、次のエラー:
メッセージ2601、レベル14、状態1 、Line 1 ユニークインデックス 'IDX_V1'を持つオブジェクト 'dbo.vwApprovedBusiness'に重複キー行を挿入できません。重複するキー値は(97ac226d-e58a-470a-a553-7c4a73551038)です。この問題の
これは私のフルテキストカタログに何らかの形で影響しますか? –
私の理解によると、フルテキストカタログ –