I have a requirement to have a full text index on SQL Server table, where the customer wants the index to be updated as soon as a record is updated. I figured the best bet could we to add this trigger on the table…
CREATE TRIGGER TR_Section_InsUpd ON dbo.[Section] AFTER INSERT, UPDATE AS
ALTER FULLTEXT CATALOG TUG REBUILD WITH ACCENT_SENSITIVITY = OFF
GO
But when this is triggered I’m told I can’t rebuild the catalog in a user transaction. Can anyone tell me how to achieve my objective? A scheduled index rebuild every couple of minutes seems like a bad idea as the table won’t be updated very often, but when it is, they want the changes available in the full text index as soon as possible.
Create an update table, for example:
Have your trigger update the relevant entry to 1. Now have a job that runs every minute or two, looking at whether or not the table has been updated and have the job rebuild the index. On completion, reset the UpdateIndex to 0.