| Re: Help with SELECT FROM OpenXML |
|
 |
|
 |
|
 |
|
 |
Group: microsoft.public.sqlserver.xml · Group Profile
Author: Jacob SebastianJacob Sebastian Date: Aug 17, 2008 20:18
My experience is that, applying a filter within the XPath expression gives
better performance.
Like Bob said, you should do some testing on your side to confirm this.
--
Jacob Sebastian
SQL Server MVP
http://www.sqlserverandxml.com
"Patrick Jackman" wimse.com> wrote in message
news:uoVwFay8IHA.5700@TK2MSFTNGP05.phx.gbl...
> Thanks Bob.
>
> I discovered that this will also work:
> SELECT LineNumber, ProductID
> FROM OpenXML(@idoc, 'OrderDetails/OrderDetail', 1)
> WITH (LineNumber INT, ProductID INT, IsNew INT, IsDirty INT, IsDeleted
> INT)
> WHERE IsNew='-1' AND IsDeleted = '0'
>
> Would there be any performance reasons to use one over the other?
>
> Patrick.
>
> "Bob" discussions.microsoft.com> wrote in message
> news:BB914C0D-C42C-4218-9A5A-3906923F1076@microsoft.com...
> SELECT LineNumber, ProductID
> FROM OpenXML(@idoc, 'OrderDetails/OrderDetail[@IsNew="-1" and
> @IsDeleted="0"]', 1)
> WITH (LineNumber INT, ProductID INT, IsNew INT, IsDirty INT, IsDeleted
> INT)
>
> work ok for you?
> HTH
> wBob
> Rate the post
>
> "Patrick Jackman" wrote:
>
>> In the FROM below what is the correct syntax for the following?
>> IsNew="-1" AND IsDeleted="0"
>>
>>
>> Declare @DetailsXML XML
>>
>> SET @DetailsXML = '
>>
>>
>> IsDirty
>> =
>> "-1" IsDeleted = "0"/>
>>
>> =
>> "0" IsDeleted = "-1"/>
>>
>> IsDirty
>> =
>> "0" IsDeleted = "0"/>
>> '
>>
>> Declare @idoc int
>> Exec sp_xml_preparedocument @idoc OUTPUT, @DetailsXML
>>
>> SELECT LineNumber, ProductID
>> FROM OpenXML(@idoc, 'OrderDetails/OrderDetail[@IsNew="-1"]', 1)
>> WITH (LineNumber INT, ProductID INT, IsNew INT, IsDirty INT,
>> IsDeleted
>> INT)
>>
>> Patrick
>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> Patrick Jackman
>> Vancouver, BC
>> 604-874-5774
>>
>>
>>
>
>
|