SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create function [dbo].[F_price](@Contractno varchar(50)) returns nvarchar(100) as begin declare @S nvarchar(100) select @S=isnull(@S,'')+convert(varchar,price)+' ' from import_cargo where Contractno=@Contractno return @S end GO select dbo.f_price('XXH201311180014')