我试图从另一个标量值函数(fn_SeqAvgSimilarityUnderNode2)调用表值函数(dbo.fn_SelectAlignedSequences)。这是查询
Create Function [dbo].[fn_SeqAvgSimilarityUnderNode]
(@AlnID int, @ParentTaxID int, @SeqTypeID int, @LocationID int)
RETURNS FLOAT
AS
BEGIN
Declare @AvgSim float
;With Seqs (SeqID) as
(-- All aligned sequences under the node
select dbo.fn_SelectAlignedSequences(@AlnID, @ParentTaxID, @SeqTypeID, @LocationID)
)
Select @AvgSim = AVG(Similarity)
From (
Select s1.SeqID
,s2.SeqID
,dbo.fn_pairwiseSimilarity(@AlnID, s1.SeqID, s2.SeqID) as 'Similarity'
From Seqs s1 cross join Seqs s2
Where s1.SeqID < s2.SeqID
) t
return @AvgSim
END
查询确实有效,但是当我调用函数dbo.fn_SeqAvgSimilarityUnderNode时,会弹出错误。
错误消息“找不到列”dbo“或用户定义的函数或聚合”dbo.fn_SelectAlignedSequences“,或者名称不明确。
我做错了什么?
答案 0 :(得分:2)
如果没有看到dbo.fn_SelectAlignedSequences的代码,我很确定你需要指定一个你想要选择的列。
更改此
With Seqs (SeqID) as
(-- All aligned sequences under the node
select dbo.fn_SelectAlignedSequences(@AlnID, @ParentTaxID, @SeqTypeID, @LocationID)
)
这样的事情
With Seqs (SeqID) as
(-- All aligned sequences under the node
select ColumnName FROM dbo.fn_SelectAlignedSequences(@AlnID, @ParentTaxID, @SeqTypeID, @LocationID)
)