In my SQL Server 2008 RC2 database I have a table T that has a full text index defined on column FT. I am trying to derive a table containing column FT, then select from this derived table using a full text operation as follows:
SELECT ft_alias FROM
(SELECT ft AS ft_alias FROM t) t_alias
WHERE CONTAINS(ft_alias, 'abc')
But this gives the error message:
Cannot use a CONTAINS or FREETEXT predicate on column 'ft_alias' because it is not full-text indexed.
No way! The optimizer can't work out that this column is full text indexed? I find this suprising, because it can and will use the index on columns with a standard index.
I realise that in this simple case I can just rewrite the query without a derived table,开发者_如何学Python but our application is generating arbitrarily complex SQL from user queries, and using derived tables makes it much easier for us to generate the correct SQL.
Is there really no way around this?
精彩评论