Juin Posted April 3, 2012 Report Share Posted April 3, 2012 É possivel fazer algo do género disto para escrever para xml SELECT text as [@text], input as [@input], input_id as [@in_id] from Evento WHERE campos IN (SELECT campos as [@camps] FROM Evento FOR XML PATH('campo'), TYPE, ROOT('campos') ) FOR XML PATH('tipo'), TYPE, ROOT('tipos') o resultado que procuro com isso é <tipos> <tipo> <campos> <campo> </campo> </campos> </tipo> </tipos> Link to comment Share on other sites More sharing options...
Caça Posted April 4, 2012 Report Share Posted April 4, 2012 Para o formato que queres, não, o máximo que consegues com isso é SELECT TEXT AS [@TEXT], INPUT AS [@INPUT], input_id AS [@in_id] FROM Evento FOR XML PATH('tipo'), TYPE, ROOT('tipos') <tipos> <tipo TEXT="..." INPUT="..." in_id="..." /> <tipo TEXT="..." INPUT="..." in_id="..." /> <tipo TEXT="..." INPUT="..." in_id="..." /> <tipo TEXT="..." INPUT="..." in_id="..." /> <tipo TEXT="..." INPUT="..." in_id="..." /> </tipos> O mais parecido para o que queres, será talvez assim SELECT TEXT AS [@TEXT], INPUT AS [@INPUT], input_id AS [@in_id], campos FROM Evento FOR XML PATH('tipo'), TYPE, ROOT('tipos') Pedro Martins Não respondo a duvidas por PM Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now