I use SQL Server 2005 and I create function.Below I mention the Function that I created.
CREATE FUNCTION dbo.udf_GetCountryID(@Name varchar(50))
RETURNS VARCHAR(1000) AS
BEGIN
Declare @Description varchar(4000)
select @Description = coalesce(@Description + ',' , '' ) + countryCode
FROM dbo.Test_Table where CommonName='Japan'
Return @Description
END
After creating function I use below SQL statement
select dbo.udf_GetCountryID(Distinct(F.CommonName))CountryName from dbo.Test_Table F
but I got the Error message.Below I mention the error message also
Msg 208, Level 16, State 101, Line 1
Invalid object name 'dbo.udf_GetCountryID'.
Once I create the function its comes under scalar-valued function.I am using sql server 2005.Please help me
Thanks
Tank50