Juin Posted April 3, 2012 at 11:41 PM Report #447393 Posted April 3, 2012 at 11:41 PM É 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>
Caça Posted April 4, 2012 at 08:49 AM Report #447406 Posted April 4, 2012 at 08:49 AM 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
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