Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
dkekesi
Starting Member
38 Posts |
Posted - 2012-01-13 : 06:28:05
|
Hi All,We are looking for a way to automatically save all data from SQL via our application GUI (not SSMS). We want to export all data from all tables into XML using 'for XML Auto' where the table name begins with 'Params'. We have about 200 tables (and the number is growing) so we are looking for a method to automatically save everything without the need to touch the SQL script every time a new table is added.Thanks for your help in advance.Best Regards,DanielBest Regards,Daniel |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-13 : 06:51:14
|
search for sp_MSforeachTable No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
dkekesi
Starting Member
38 Posts |
Posted - 2012-01-13 : 08:28:43
|
quote: Originally posted by webfred search for sp_MSforeachTable No, you're never too old to Yak'n'Roll if you're too young to die.
Thanks for the tip, it is really useful. The selection is happening nicely, but the problem is that all table data will result in a separate XML stream, however, I want to create a single XML.I use the following query:EXEC sp_MSforeachtable @command1 = N'CAST(select * from ? for xml auto)', @whereand = N'and o.name like ''Params%''') AS XML) How would I go about combining the result sets into one? Or shall I modify sp_MSforeachtable? I'd like to make this selection as fast as possible so I'd like to avoid selecting XMLs into a temp table then concatenating them into a single XML stream.Best Regards,Daniel |
 |
|
|
|
|