2

How can I have a full text index on all columns without specifying individual column names via script in SQL Server?

My table has 50 columns, and I'd like the full text index to cover them all.

Can this be done?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
  • You have to specify the column names as required by the syntax description, but if you're working in SSMS them just [drag and drop the Columns folder](http://sometechcompany.com/TechBlog/QuickTipDragnDropColumnNamesinSQLServerM.aspx) from the table into the query window and it will give you all the column names. Or you could write a script in TSQL or another language to generate the `CREATE INDEX` script using the table name as an input parameter. – Pondlife May 01 '13 at 21:13

1 Answers1

0
CREATE FULLTEXT INDEX ON table_name
   [ ( { column_name 
             [ TYPE COLUMN type_column_name ]
             [ LANGUAGE language_term ] 
             [ STATISTICAL_SEMANTICS ]
        } [ ,...n] 
      ) ]
    KEY INDEX index_name 
    [ ON <catalog_filegroup_option> ]
    [ WITH [ ( ] <with_option> [ ,...n] [ ) ] ]
[;]

<catalog_filegroup_option>::=
 {
    fulltext_catalog_name 
 | ( fulltext_catalog_name, FILEGROUP filegroup_name )
 | ( FILEGROUP filegroup_name, fulltext_catalog_name )
 | ( FILEGROUP filegroup_name )
 }

<with_option>::=
 {
   CHANGE_TRACKING [ = ] { MANUAL | AUTO | OFF [, NO POPULATION ] } 
 | STOPLIST [ = ] { OFF | SYSTEM | stoplist_name }
 | SEARCH PROPERTY LIST [ = ] property_list_name 
 }

Refer MSDN:

http://msdn.microsoft.com/en-us/library/ms187317.aspx

As well refer this question:

Trying to set up Full Text Search for SQL Server Via Script

Community
  • 1
  • 1
Freelancer
  • 9,008
  • 7
  • 42
  • 81