[英]sql server The multi-part identifier “ ” could not be bound stored procedure
我创建了一个存储过程,在其中调用了两个函数。
我收到一个错误:
消息4104,级别16,状态1,过程Add_Translation,第25行
无法绑定多部分标识符“ .word”。
这是我的存储过程:
ALTER PROCEDURE [dbo].[Add_Translation]
@english nvarchar(70),
@kurdish nvarchar(70),
@english_category int,
@kurdish_category int,
@result int out
AS
BEGIN
SET NOCOUNT ON;
if @english is not null and @kurdish is not null and @english_category is not null and @kurdish_category is not null
begin
declare @intEnId int=-1;
exec @intEnId = Check_English_word @text = @english;
declare @identityEnglish int;
declare @identityKurdish int;
if @intEnId = -1
begin
insert into english_table values(@english, @english_category);
set @identityEnglish = SCOPE_IDENTITY();
end
else
begin
set @identityEnglish = (select e.english_id from english_table e where UPPER(.word)=UPPER(@english));
end
declare @intKuId int=-1;
exec @intKuId=Check_Kurdish_Word @word=@kurdish;
if @intKuId =-1
begin
insert into kurdish_table values(@kurdish, @kurdish_category);
set @identityKurdish = SCOPE_IDENTITY();
end
else
begin
set @identityKurdish = (select k.kurdish_id from kurdish_table k where upper(k.word)=upper(@kurdish));
end
declare @translated int =0;
exec @translated = Check_Translation @english_id = @identityEnglish, @kurdish_id = @identityKurdish;
if @translated=0
begin
insert into transactions values(@identityEnglish, @identityKurdish);
set @result = 1;
end
else
begin
set @result = 2;
end
end
else
begin
set @result = 0;
end
END
这是第一个功能:
ALTER FUNCTION [dbo].[Check_English_word]
(
@text nvarchar(70)
)
RETURNS int
AS
BEGIN
DECLARE @Result int
set @Result=-1;
if @text is not null
begin
SELECT @Result = e.english_id
from english_table e
where UPPER(e.word) = UPPER(@text);
end
RETURN @Result
END
第二功能:
ALTER FUNCTION [dbo].[Check_Kurdish_Word]
(
@word nvarchar(70)
)
RETURNS int
AS
BEGIN
DECLARE @Result int
set @Result=-1;
if @word is not null
begin
SELECT @Result = k.kurdish_id
from kurdish_table k
where UPPER(k.word) = UPPER(@word);
end
RETURN @Result
END
您在此行中缺少e
set @identityEnglish=(select e.english_id from english_table e
where UPPER(.word)=UPPER(@english));
更改为
set @identityEnglish=(select e.english_id from english_table e
where UPPER(e.word)=UPPER(@english));
同样,在执行插入操作时指定列也是个好习惯-即
insert into english_table values(@english,@englsih_category);
应该
insert into english_table (word, category) values(@english,@englsih_category);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.