我有一个这样的存储过程:
ALTER procedure [dbo].[fetchkey]
@carid nvarchar(50) =null
as
begin
select t.TBarcode, t.Status, [dbo].[keyloc](t.Status) as 'Key location'
from Transaction_tbl t
where t.TBarcode=@carid
end
我有一个与此存储过程关联的函数:
ALTER function [dbo].[keyloc](@status numeric(18,2)) RETURNS varchar(50)
as begin declare
@car nvarchar(100), @keylocation Varchar(50)
if @status=0
begin
select @car = t1.TBarcode from Transaction_tbl t1
select @keylocation='With Employee'+'('+@car+')'
return @keylocation
end
我是carid
我的Tbarcode
,但是在执行输出时出错了
my output:
TBarcode Status Key location
-------------------- ----------- ----------------------
53012364813 0 With Employee(717164016319).
我想Tbarcode
在 With Employee中得到同样的结果
Expected output
TBarcode Status Key location
-------------------- ----------- ----------------------
53012364813 0 With Employee(53012364813).
我的代码有什么问题?