Hi ,
I have quite a simple SQL
SELECT EAR_LOB, Controller
FROM Ultimate_Claim_Segmentation
GROUP BY EAR_LOB, Controller
HAVING Ultimate_Claim_Segmentation.Controller=[Control_Segment];
, which I am trying to execute as a function so that I can insert [control_segment] as a parameter.
In Access, it would automatically as for the parameter value, but I want to build a function which works in the same way..SO i tried:
create function dbo.Control_Segment(@conseg varchar(10))
returns varchar(10)
as begin
SELECT EAR_LOB
, Controller
FROM Ultimate_Claim_Segmentation
GROUP BY EAR_LOB
, Controller
HAVING Controller=@conseg
end
Unfortunately it doesn't work. the error is :
"Select statements included within a function cannot return data to a client."
what am I doing wrong???
I have quite a simple SQL
SELECT EAR_LOB, Controller
FROM Ultimate_Claim_Segmentation
GROUP BY EAR_LOB, Controller
HAVING Ultimate_Claim_Segmentation.Controller=[Control_Segment];
, which I am trying to execute as a function so that I can insert [control_segment] as a parameter.
In Access, it would automatically as for the parameter value, but I want to build a function which works in the same way..SO i tried:
create function dbo.Control_Segment(@conseg varchar(10))
returns varchar(10)
as begin
SELECT EAR_LOB
, Controller
FROM Ultimate_Claim_Segmentation
GROUP BY EAR_LOB
, Controller
HAVING Controller=@conseg
end
Unfortunately it doesn't work. the error is :
"Select statements included within a function cannot return data to a client."
what am I doing wrong???