These two insert statements add a row for the publishers table and a row for the authors table to the the sample_docs table. Each row contains a column that identifies the row (‘publishers’, ‘titles’), and a text_doc column. Call the select command with the for xml option to generate the XML document:
insert into sample_docs (name_doc, text_doc) select 'publishers', (select * from publishers for xml) insert into sample_docs (name_doc, text_doc) select 'titles', (select title_id, title, type, pub_id, price, advance, total_sales from titles for xml)