Problemas de xml de Nfce com campo NFCxxxxxx

Modificado em Sun, 17 Sep 2023 na (o) 02:08 PM

O primeiro passo é executar a query na base do cliente


select 1Qry+myXML+2Qry from (
select 
  'Update Nfce set xml=''' as [1Qry],
  cast( [QuerReplace] as nvarchar(max)) as [myXML],
  ''' where nfceId='+cast( NFCeID as nvarchar(max)) as [2Qry]
from (SELECT
(SELECT REPLACE(cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID) as nvarchar(max)),SUBSTRING(cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID) as nvarchar(max)), CHARINDEX('<Id>',cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID)as nvarchar(max))),(CHARINDEX('</Id>',cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID)as nvarchar(max))) + 5)-(CHARINDEX('<Id>',cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID)as nvarchar(max))))),'')) as [QuerReplace],
NfCeID

from
NFCe

where nfceID in (select NFCeID from NFCe where xml like '%><id>%')) as cons

) as Cons


Copiar código gerado e executar 

Este artigo foi útil?

Que bom!

Obrigado pelo seu feedback

Desculpe! Não conseguimos ajudar você

Obrigado pelo seu feedback

Deixe-nos saber como podemos melhorar este artigo!

Selecione pelo menos um dos motivos

Feedback enviado

Agradecemos seu esforço e tentaremos corrigir o artigo