SQL Server 2005
I want to call UDF that returns table in SELECT statement as below.
select *, GetIptoCountry(IP_address) as country from tblInfo
but I am getting following error
'GetIptoCountry' is not a recognized built-in function name.
IP_address is the column in tblInfo.
How can I call UDF like this?
You have to use the fully qualified name of the function including the schema name :
For example (if the scema is dbo), you can call the function with dbo.GetIptoCountry():
select *, dbo.GetIptoCountry(IP_address) as country from tblInfo
UPDATE:
According your last comment, you seems to have a table-valued function (wich returns table rows), not a scalar-valued function (wich returns a value), so the call can be done like this:
Select * from dbo.GetIptoCountry('your_ip_adress');
Your final query can looks like:
select *
from tblInfo
cross apply dbo.GetIptoCountry(IP_address) tblCountry
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With