Topic
  • No replies
SystemAdmin
SystemAdmin
746 Posts

Pinned topic Xquery Procedure

‏2012-07-17T09:04:28Z |
Hi All

Any help would be dearly appreciated, I'm new to xquery.

I have a procedure, that I want to query an xml in sql server 2005, problem is, I want to have parameters, where I could use the "like" operator instead of @ID=sql:variable("@id"), is there a way, where I can implement the "like" instead of the "=" operator?

Here's my whole procedure:
create procedure dbo.TestXML
@id int,
@extent int,
@rate int,
@value int
as begin
SET NOCOUNT ON;
if(len(@id)<=0)
begin
set @id='%'
end
if(len(@extent)<=0)
begin
set @extent='%'
end
if(len(@rate)<=0)
begin
set @rate='%'
end
if(len(@value)<=0)
begin
set @value='%'
end
Select XML.query('/Agriculture/LandInformation/LandInfo') AS Tag
From AgricultureXML Where XML.exist('/Agriculture/LandInformation/LandInfo')=1
end
Thanks in advance for any help