Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cost of query
Message
From
19/03/2010 20:30:21
Moacyr Zalcman
Independent Consultant
São Paulo, Brazil
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Environment versions
SQL Server:
SQL Server 2005
Application:
Desktop
Miscellaneous
Thread ID:
01455721
Message ID:
01455799
Views:
27
Thanks Naomi

Is there an excellent article about performance of SQL SERVER XML type in the blog you pointed to.
I took off all the linking to other tables but the cost remains high(371 X 445). The problem probably is the transformation of XML in a relational format.

After some research the query below solved the problem
SELECT prodname,refeetiq,eancode,localizador,numeracao,posicao,
 OrcamentoItens.Produtos.value('(ProdID/text())[1]','char(10)')
  As ProdID,
 OrcamentoItens.Produtos.value('(Qtd/text())[1]','int') as qtd,
 OrcamentoItens.Produtos.value('(ValorU/text())[1]','numeric(10,2)') as valorU,
 OrcamentoItens.Produtos.value('(Grade/text()([1]','varchar(60)') as grade,
 OrcamentoItens.Produtos.value('(Obs/text())[1]','varchar(254)') as obs,
 @tcOrcamentoID as orcamentoID,
 @dadosCliente as ClienteInfo,
 @InternetID as InternetID
FROM
 @xmlItens.nodes('/OrcamentoItens/Produto') OrcamentoItens(Produtos)
left join produto on produto.id=OrcamentoItens.Produtos.value('ProdID[1]','char(10)')
inner join categprod on produto.categoryID=categprod.ID
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform