我的sql函数不是工作参数值。如果提供硬代码值,它将给我结果。
ALTER function [dbo].[team_concat] (@input varchar)
returns varchar(8000)
as
BEGIN
declare @putout varchar(8000)
set @putout = null
-- select @putout = COALESCE(IsNull(@putout+ ', ', ''), '') + team_residence_location from programs where team_combo = 'Hartford CIS / Coaching'
select @putout = COALESCE(IsNull(@putout+ ', ', ''), '') + team_residence_location from programs where team_combo = @input
return @putout
答案 0 :(得分:1)
尝试一下:
ALTER function [dbo].[team_concat] (@input varchar(100)) --- specify length
returns varchar(8000)
as
BEGIN
declare @putout varchar(8000)
set @putout = null
-- select @putout = COALESCE(IsNull(@putout+ ', ', ''), '') + team_residence_location from programs where team_combo = 'Hartford CIS / Coaching'
select @putout = COALESCE(IsNull(@putout+ ', ', ''), '') + team_residence_location from programs where team_combo = @input
return @putout