views:

27

answers:

2

I have a console app that exports my entity models to my sql db and I am able to export that schema to an .sql file without issue. However, my DBA's want .sql files for all the initial data that should be populated in the db as well. My console app uses NHibernate to save a bunch of objects to the database right after it creates the database (Fluent NHibernate's .CreateDatabase()). But, now, I need to find a way to export all the inserts/updates that happen after creation. Looking around on google for a few minutes didn't turn up much. Any help would be appreciated.

+2  A: 

You can enable tracing using

<property name="show_sql">true</property>

Then you can use .NET configuration to save your tracing to a file or just see it in DebugView and save it to a file in there.

Have a look in here:

http://support.microsoft.com/kb/815788

Aliostad
A: 

I don't know if I would deal with it like this. you can try a tool like red-gates SQL Packager it will generate both schema and the data scripts from your database.

Aaron Fischer