次のようなストアド プロシージャがあります。
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
このストアド プロシージャに関連付けられた関数が 1 つあります。
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
my として渡していますTbarcode
が、出力の実行中に put が間違っています
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).
コードの何が問題になっていますか?