Wednesday, March 7, 2012

How to set full-text indexing on table which has multi-columns as primary key?

Dear sirs,
How to set full-text indexing on table which has multi-columns as primary
key?
Thanks
ABC,
Unfortunately, it is not directly possible in any SQL Server versions,
including SQL Server 2005 as you must have a unique, single non-nullable
column to FT-enabled a table... That said, the workaround is easy. Alter the
table and add a int column with the identity property, for example:
use Northwind
go
exec sp_help EmployeeTerritories -- PK is PK_EmployeeTerritories
(EmployeeID, TerritoryID)
go
-- Alter Table: add unique, single non-nullable column
ALTER TABLE EmployeeTerritories ADD ET_Ident int identity (1, 1) NOT NULL
go
CREATE UNIQUE INDEX ET_Ident_IDX on EmployeeTerritories(ET_Ident)
go
exec sp_help EmployeeTerritories
Hope that helps!
John
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"ABC" <abc.abc.com> wrote in message
news:%23$mqjDlwFHA.3256@.TK2MSFTNGP09.phx.gbl...
> Dear sirs,
> How to set full-text indexing on table which has multi-columns as primary
> key?
> Thanks
>
|||Thanks, It will be a large great workload to alter all tables (over 200
tables).
"John Kane" <jt-kane@.comcast.net> wrote in message
news:O7mMWulwFHA.1148@.TK2MSFTNGP11.phx.gbl...
> ABC,
> Unfortunately, it is not directly possible in any SQL Server versions,
> including SQL Server 2005 as you must have a unique, single non-nullable
> column to FT-enabled a table... That said, the workaround is easy. Alter
> the table and add a int column with the identity property, for example:
> use Northwind
> go
> exec sp_help EmployeeTerritories -- PK is PK_EmployeeTerritories
> (EmployeeID, TerritoryID)
> go
> -- Alter Table: add unique, single non-nullable column
> ALTER TABLE EmployeeTerritories ADD ET_Ident int identity (1, 1) NOT NULL
> go
> CREATE UNIQUE INDEX ET_Ident_IDX on EmployeeTerritories(ET_Ident)
> go
> exec sp_help EmployeeTerritories
>
> Hope that helps!
> John
> --
> SQL Full Text Search Blog
> http://spaces.msn.com/members/jtkane/
>
> "ABC" <abc.abc.com> wrote in message
> news:%23$mqjDlwFHA.3256@.TK2MSFTNGP09.phx.gbl...
>
|||You're welcome, ABC,
Unfortunately, this limit is by design and *might* be lifted in the next
version of SQL Server, post-SQL Server 2005.
However, if you're FT-enabling over 200 tables, you should be aware of
another SQL Server 2000 (and not SQL 2005) limit of 256 FT Catalogs per
server (machine). I'd recommend that you create a limited number of related
FT Catalogs and then use these to place more than one Ft-enabled table in
each FT Catalog.
Regards,
John
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"ABC" <abc.abc.com> wrote in message
news:efXQuMnwFHA.2072@.TK2MSFTNGP14.phx.gbl...
> Thanks, It will be a large great workload to alter all tables (over 200
> tables).
>
> "John Kane" <jt-kane@.comcast.net> wrote in message
> news:O7mMWulwFHA.1148@.TK2MSFTNGP11.phx.gbl...
>

No comments:

Post a Comment