Click here to Skip to main content
15,351,370 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
i need export sql database to csv file with relations but i need all tables in one sheet. i try export data in the sql server management studio but it export each table to file. <a href="">like this image</a>

What I have tried:

i try export from sql server management studio but it export each table to file
Updated 12-Nov-20 21:56pm
Gerry Schmitz 12-Nov-20 14:25pm
Do a UNION on all the tables; assuming they're compatible.
Maciej Los 13-Nov-20 3:46am
Sheet or Workbook? This matters!

1 solution

In a short: a csv file is a text file and knows nothing about relationships...

If you would like to export data into Excel workbook to keep corresponding data under [+] sign, then you have to write custom macro (or program). Note, that [+] sign is used to group data. See: Outline (group) data in a worksheet - Excel[^]

In other words, you can't achieve that by using standard SSMS functionality.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900