CREATE FUNCTION dbo.ta_OTMultiplierstest (@id int)
RETURNS nvarchar (100)
AS
BEGIN
DECLARE @text nvarchar(100)
set @text = ( SELECT CONVERT(nvarchar(5), b.Duration), CONVERT(nvarchar(5),b.Mon), CONVERT(nvarchar(5), b.Tue), CONVERT(nvarchar(5), b.Wed),
CONVERT(nvarchar(5), b.Thu), CONVERT(nvarchar(5), b.Fri), CONVERT(nvarchar(5), b.Sat), CONVERT(nvarchar(5), b.Sun),
CONVERT(nvarchar(5), b.DayOff), CONVERT(nvarchar(5), b.Holiday), CONVERT(nvarchar(5), b.Yearly),
CONVERT(nvarchar(5), b.Maternity), CONVERT(nvarchar(5), b.Other)
FROM ta_GenPolOTMultiplier b WHERE b.PolHistID = @id
Group By b.Duration)--, b.Mon, b.Tue, b.Wed, b.Thu, b.Fri, b.Sat, b.Sun, b.DayOff, b.Holiday, b.Yearly, b.Maternity, b.Other)
return @text
END
I'm getting this error "Only one expression can be specified in the select list when the subquery is not introduced with EXISTS" I know that i can't return more than one field I just need to know how i can solve this ? I need to return this function in a stored procedure and get a table of all these values
I appreciate any help