Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cost of query
Message
De
19/03/2010 20:30:21
Moacyr Zalcman
Independent Consultant
São Paulo, Brésil
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Versions des environnements
SQL Server:
SQL Server 2005
Application:
Desktop
Divers
Thread ID:
01455721
Message ID:
01455799
Vues:
28
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform