0

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

Edited by Tank50: n/a

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Tank50
1

Hi,

Could you give a try with following code change;

SELECT DISTINCT(dbo.udf_GetCountryID(F.CommonName)) AS CountryName 
FROM dbo.Test_Table F

Good luck.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.