2011-12-23

Primary, secondary, tertiary, etc


01: primary
02: secondary
03: tertiary
04: quaternary
05: quinary
06: senary
07: septenary
08: octonary
09: nonary
10: denary
11: ?
12: duodenary

2011-12-16

TSQL - Full text search useful queries


-- Languanges
select
      *
from
      sys.fulltext_languages
order by
      name
;


-- Catalogs
select
      *
from
      sys.fulltext_catalogs
;


-- Indexes
select
      *
from
      sys.fulltext_indexes
;



-- Index browsing
select
      *
from
      sys.dm_fts_index_keywords(
            DB_ID('DATABASE_NAME_HERE')
            , OBJECT_ID('TABLE_NAME_HERE')
      ) as V1
where
      display_term <> 'END OF FILE'
;




2011-12-14

TSQL - How to create a full text catalog, index and search

use AdventureWorks
go


-- Create the catalog
CREATE FULLTEXT CATALOG AdventureWorksFullTextCatalog;
GO


-- Create the full text index on the desired column(s)
CREATE FULLTEXT INDEX ON Production.ProductDescription
(
      Description Language 1033
)
KEY INDEX PK_ProductDescription_ProductDescriptionID
ON AdventureWorksFullTextCatalog;
GO


-- Search sample
DECLARE @SearchWord nvarchar(30);
      SET @SearchWord = N'high-performance';
SELECT
      Description
FROM
      AdventureWorks.Production.ProductDescription
WHERE
      FREETEXT(Description, @SearchWord)
;