This is a cursor based script from Microsoft to use for full text populations
-- Sample script to start full-text index population for
-- each full-text index.
create Procedure sp_STARTFULLTEXTPOPULATION as
DECLARE @table_name NVARCHAR(517),
@schema_name NVARCHAR(517);
DECLARE @exec_str NVARCHAR(4000);
DECLARE @change_tracking_state NCHAR(1);
-- Retrieve a list of tables with full-text indexes and start full
-- full-text index population for each full-text index.
DECLARE ms_crs_ftind CURSOR STATIC LOCAL FOR
SELECT t.name, SCHEMA_NAME(t.schema_id), ft.change_tracking_state
FROM sys.fulltext_indexes AS ft
JOIN sys.tables AS t
ON (ft.object_id = t.object_id);
OPEN ms_crs_ftind;
FETCH ms_crs_ftind INTO @table_name, @schema_name, @change_tracking_state;
WHILE @@FETCH_STATUS >= 0
BEGIN
-- Start full-text index population for each full-text index.
SELECT @exec_str = 'ALTER FULLTEXT INDEX ON '
+ QUOTENAME(@schema_name,'[')+'.'+QUOTENAME(@table_name,'[')
+ ' start full POPULATION ';
EXEC (@exec_str);
FETCH ms_crs_ftind INTO @table_name,@schema_name, @change_tracking_state;
END
DEALLOCATE ms_crs_ftind;
--For stop, just replace 'start full' with 'STOP'
Thursday, April 16, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment