2

stockView 是具有全文索引的索引视图,我收到以下错误消息。该数据库以 2005 兼容模式在 2008 Express 引擎上运行。

代码:

with stockCte (title, grade, price, weighted)
as
(
    select sv.[title]                   ,
            sv.[grade]                  ,
            sv.[price]                  ,
            (case when sv.[issue] = @issue and svs.[rank] > 30
                then svs.[rank] + 100
                else svs.[rank]
                end)                    weighted
    from stockView sv
    inner join freetexttable(stockView, (name), @term) svs
        on sv.[id] = svs.[key]
)
select * from stockCte;

错误:

Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command.  The results, if any, should be discarded.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command.  The results, if any, should be discarded.

当我删除内部联接和加权列时,查询有效。任何想法,我都不知所措。

4

3 回答 3

1

它也没有在 R2 中修复,但有一个修复程序 - 请参阅知识库文章 #2421014。

于 2011-07-01T00:38:37.910 回答
0

错误级别 11 是找不到数据库对象;freetexttable 查询上的选择是否作为选择工作?如果是这样,完整查询是否可以作为选择(没有 cte 定义?)

于 2009-06-14T17:06:30.733 回答
0

我不情愿地使用表变量而不是 CTE。

declare @stockTemp table(
    title               nvarchar(100),
    grade               nvarchar(50),
    price               money,
    row                 bigint
);

insert into @stockTemp
select sv.[title]                   ,
        sv.[grade]                  ,
        sv.[price]                  ,
        row_number() over (order by (case when sv.[issue] = @issue and svs.[rank] > 30
                                            then svs.[rank] + 100
                                            else svs.[rank]
                                            end) desc,
                                        sv.title,
                                        sv.grade desc,
                                        sv.price asc)
from stockView sv
inner join freetexttable(stockView, (*), @term) svs
    on sv.[id] = svs.[key]

select * from @stockTemp;

如果有人有更好的建议,请告诉我。

于 2009-06-14T17:43:50.863 回答