0
0
01vadim102017-10-17 16:00:59
Python
01vadim10, 2017-10-17 16:00:59

How to export DB from SQL Server to Xml file?

You need to export the test database from SQL Server to an Xml file. Attempts to find a solution myself using the tools of SQL Management Studio did not lead to anything. I tried to convert both via bulk and via FOR XML, but they only allow you to convert each table separately, and I need to export the entire database into one file, besides, this xml database sometimes needs to be updated, due to a change, albeit rare class structures in the project. Tell me in which direction to dig, preferably using C # or Python

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Skorzhinsky, 2017-10-17
@01vadim10

Something like this:

declare @s nvarchar(max)  = ''
select @s  = @s  +
'select * from '+TABLE_NAME+' for xml auto;'
  from INFORMATION_SCHEMA.TABLES 

exec (@s)

K
Konstantin Tsvetkov, 2019-03-22
@tsklab

For a schema with single file data, there is a data-tier application export .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question