gpt4 book ai didi

sql-server - SQL函数错误: The multi-part identifier "T.acKey" could not be bound

转载 作者:行者123 更新时间:2023-12-03 02:56:47 27 4
gpt4 key购买 nike

我有这个功能:

create FUNCTION dbo.fPA_TodoKeyValues(@acKey varchar(255))
returns @retRecords table(acSubject char(30))
AS

begin
declare @doctype char(1)
set @doctype = SUBSTRING(@acKey,1,1)
--primercreate procedure [dbo].[pPA_MailJournalCreDoc]
if @doctype = 'F'--računi
insert @retRecords(acSubject)
select
case when D.acSetOf='F' and D.acType = 'P' then M.acReceiver
when D.acSetOf='F' and D.acType = 'I' then M.acIssuer
else M.acReceiver
end
from
tHE_Move M
join tPA_SetDocType D on D.acDocType =M.acDocType


if @doctype = 'M'--mailjournal
insert @retRecords(acSubject)
select acSubject from tPA_MailJournal
-- JOIN tPA_LinkMailMove
return
end

我必须做出这样的 View

select acName,acsubject from vPA_ToDo T
cross join fPA_TodoKeyValues(T.acKey) tv

但是当我运行此代码时,我收到此错误:

Msg 4104, Level 16, State 1, Line 2 The multi-part identifier "T.acKey" could not be bound.

有人可以告诉我我做错了什么吗?表中只有一个名为 acKey 的字段。

最佳答案

使用外部应用:

SELECT
acName,
acsubject,
*
FROM vPA_ToDo T
OUTER APPLY fPA_TodoKeyValues(T.acKey)

关于sql-server - SQL函数错误: The multi-part identifier "T.acKey" could not be bound,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32762402/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com