title: Invalid Object Name Error in Function in SQL
body: <p>I have following function defined</p>
  
  <pre><code>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
  </code></pre>
  
  <p>WHen i hit F5 command Executes Successfully/...</p>
  
  <p>but when i try to execute it using following query :</p>
  
  <pre><code>select * from [GetXMLValues](1,'sadfj')
  </code></pre>
  
  <p>it shows an error saying : <code>Invalid object name 'GetXMLValues'.</code></p>
  
  <p>what is the reason ? and what is error??</p>