Question

I have Products table which include Name and ModelNumber. I need to enable Full Text Search on these fields only if the Full Text Search is not enabled before using tsql in SQL Server 2012

Était-ce utile?

La solution

Not sure but if you are asking TSQL command to enable FULL TEXT search on your table then you can use the below TSQL queries for the same

use [DB_NAME]

CREATE FULLTEXT CATALOG productcat AS DEFAULT;
GO

EXEC [DB_NAME].[dbo].[sp_fulltext_database] @action = 'enable'
GO

(OR)

USE [DB_NAME];
GO
CREATE FULLTEXT CATALOG productcat;
GO
CREATE FULLTEXT INDEX ON Products
 ( 
  Name
     Language 1033,
  ModelNumber
     Language 1033   
 ) 
  KEY INDEX PK_Products_ProductName 
      ON productcat; 
GO

See CREATE FULLTEXT INDEX (Transact-SQL) for more information

EDIT:

In case you want to know whether FULL TEXT is installed or not; you can use below command

select SERVERPROPERTY('IsFullTextInstalled')

If the above query returns a 1 then the component is installed.

In case you want to check whether a particular table has FULL TEXT enabled

SELECT OBJECTPROPERTYEX(OBJECT_ID('Products'), 'TableHasActiveFulltextIndex');
GO
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top