Generate data insert script from database
It would be nice to have the ability to generate a data insert script from a database without having to use SQL Data Compare. Currently, the way I do this is to create a second, empty database with the same schema, perform a data compare operation between the current database and the newly created, empty database, and then generate a deployment script. I wrote an application to do this using the SQL Data Compare API, but it is still problematic because it requires that you build a second database first, which requires that you have the schema scripted. It is not possible to do this with an existing database for which you don't have the schema. Perhaps there is a Red Gate tool or API that would allow this already, but I am not aware of one.
-
tdennis commented
SQLDataCompare.exe command line can compare to /empty2 to pretend it's an empty database.
-
Ray Atkinson commented
I use often http://www.yanDATAellan.com tool to generate my test databases; it is simple, rich of functionalities, and user-friendly. You could generate up to 10.000 rows of mock data in several file formats (CSV, Excel, SQL, JSON, HTML, and XML). Take a look!