Code
CREATE FUNCTION uf_GetRowString
(
@ID varchar(20)
)
RETURNS NVARCHAR(1000)
AS
BEGIN
-- Declare the return variable here
DECLARE @ResultVar NVARCHAR(1000)
SET @ResultVar=''
SELECT @ResultVar=@ResultVar +','+col1
from tab1 WHERE ID=@ID
IF @ResultVar<>''
SET @ResultVar = stuff(@ResultVar,1,1,'')
RETURN @ResultVar
END
GO
CREATE FUNCTION uf_GetRowString
(
@ID varchar(20)
)
RETURNS NVARCHAR(1000)
AS
BEGIN
-- Declare the return variable here
DECLARE @ResultVar NVARCHAR(1000)
SET @ResultVar=''
SELECT @ResultVar=@ResultVar +','+col1
from tab1 WHERE ID=@ID
IF @ResultVar<>''
SET @ResultVar = stuff(@ResultVar,1,1,'')
RETURN @ResultVar
END
GO