Question: Could you help me, please figure out why t-sql expression following:

```
  DECLARE @SearchWord varchar(max)
SET @SearchWord = '"I went to primary school in London "'
SELECT * FROM sys.dm_fts_parser('FormsOf(INFLECTIONAL, '+ @SearchWord + ')', 1033, 0, 0) 
where display_term in 
( SELECT display_term FROM sys.dm_fts_parser('FORMSOF(INFLECTIONAL, "go to school")', 1033, null, 0) )

```

returns

![enter image description here](https://i.stack.imgur.com/1tT1w.jpg)

while

```
DECLARE @SearchWord varchar(max)
SET @SearchWord = '"I went. to primary school in London "'
SELECT * FROM sys.dm_fts_parser('FormsOf(INFLECTIONAL, '+ @SearchWord + ')', 1033, 0, 0) 
where display_term in 
( SELECT display_term FROM sys.dm_fts_parser('FORMSOF(INFLECTIONAL, "go to school")', 1033, null, 0) )

```

returns

![enter image description here](https://i.stack.imgur.com/85lwq.jpg)

i.e. when a single dot is added somewhere in the searchstring, the corresponding occurrences shift by 8 positions? Is there something wrong with dot or maybe my t-sql expression?
Thanks in advance!

Answer: 
First, the [documentation](http://msdn.microsoft.com/en-us/library/cc280463.aspx) says that `occurrence` indicates *order*, not *position*. That means that the values can be relative, not absolute, but still correctly show the order.

Next, by observation the first digit of the number indicates the zero-based sentence number (except for the first sentence, where there is no leading zero). A 'dot' is actually a [full stop](http://en.wikipedia.org/wiki/Full_stop), which ends a sentence in English, so it isn't surprising that there is something significant about it. Look at the output from this query, and you'll see the 'end of sentence' special term:

```
DECLARE @SearchWord varchar(max) = N'"I went. to primary school in London. it was a nice school. to go there was fun"'
SELECT * 
FROM sys.dm_fts_parser('FormsOf(INFLECTIONAL, '+ @SearchWord + ')', 1033, 0, 0)

```

If you then look at your query with the longer sentence...

```
DECLARE @SearchWord varchar(max) = N'"I went. to primary school in London. it was a nice school. to go there was fun"'
SELECT * 
FROM sys.dm_fts_parser('FormsOf(INFLECTIONAL, '+ @SearchWord + ')', 1033, 0, 0)
where display_term in 
(SELECT display_term FROM sys.dm_fts_parser('FORMSOF(INFLECTIONAL, "go to school")', 1033, null, 0))

```

... you can see that for sentences 1 and 2 the `occurrence` is indeed also the word position, but for sentences 3 and 4 it isn't. I have no idea why this happens and there is nothing in the documentation to explain it, but since the documentation does not say that `occurrence` is the same thing as the position, it isn't totally surprising.

These questions may be interesting too:

* [How do I get the position of the match in a FORMSOF INFLECTIONAL full-text search?](https://stackoverflow.com/questions/3662419/how-do-i-get-the-position-of-the-match-in-a-formsof-inflectional-full-text-searc)
* [How to find position of search keyword in full text search?](https://stackoverflow.com/questions/14089796/how-to-find-position-of-search-keyword-in-full-text-search)
As @Pondlife suggested to use PATINDEX() to find positions(not occurrences) I was able to overcome the mentioned issue with `dm_fts_parser`. The below t-sql returns exact position and length of all of match forms(INFLECTIONAL) in specific text no matter `@SearchWord` contains dot or not:

```
DECLARE @SearchWord nvarchar(max)

SET @SearchWord = N'"I went. to primary school in London "'

SELECT distinct y.pos,y.lgth from 
(
SELECT w.*,
PATINDEX(N'%[^a-z]' + w.Display_Term + N'[^a-z]%',@SearchWord) as pos, LEN(w.display_term) as lgth
 FROM sys.dm_fts_parser(N'FormsOf(INFLECTIONAL, '+ @SearchWord + ')', 1033, 0, 0) w 
where display_term in 
( SELECT display_term FROM sys.dm_fts_parser('FORMSOF(INFLECTIONAL, "go to school")', 1033, 0, 0) ) and 
PATINDEX(N'%[^a-z]' + w.Display_Term + N'[^a-z]%',
@SearchWord)<>0
) y

```

and it returns result set below:

![enter image description here](https://i.stack.imgur.com/5ZRct.jpg)