asp.net - Invalid Object Name Error in Function in SQL -
i have following function defined
alter function [dbo].[getxmlvalues](@business_id int, @id varchar(30)) returns varchar(30) begin declare @xmlvalue varchar(30) set @xmlvalue = (select top 1000 t.content.value('(/xmldatapairdocument/dataitem[@id=sql:variable("@id")]/@value)[1]', 'varchar(100)') tblapplications t t.business_id =@business_id) return @xmlvalue end
when hit f5 command executes successfully/...
but when try execute using following query :
select * [getxmlvalues](1,'sadfj')
it shows error saying : invalid object name 'getxmlvalues'.
what reason ? , error??
this scalar function, not table-valued function.
select dbo.[getxmlvalues](1,'sadfj')
should work.
you can't treat table, i.e. select * ...
, need select result directly above.
see types of functions more details.
Comments
Post a Comment