Invalid Object Name Error in Function in SQL
asp.net, sql, sql-server
Solution
This is a Scalar function, not a Table-Valued function.
select dbo.[GetXMLValues](1,'sadfj')
should work.
You can't treat this like a table, i.e. `select * ...`, you need to just select the result directly as above.
See Types of Functions for more details.
Problem
I have following function defined ``` alter FUNCTION [dbo].[GetXMLValues](@business_id int, @id varchar(30)) RETURNS varchar(30) AS BEGIN declare @xmlValue varchar(30) set @xmlValue = (SELECT top 1000 T.Content.value('(/XmlDataPairDocument/dataitem[@id=sql:variable("@id")]/@value)[1]', 'VARCHAR(100)') FROM tblApplications T where t.business_id =@business_id) return @xmlValue END ``` WHen i hit F5 command Executes Successfully/... but when i try to execute it using following query : ``` select * from [GetXMLValues](1,'sadfj') ``` it shows an error saying : `Invalid object name 'GetXMLValues'.` what is the reason ? and what is error??