Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want to be able to dump a database schema to a sql text file using Powershell. I want this because our DBAs want to be able to do a diff on the file that is committed to SVN. They won't execute it if they can't see what it contains.

I've found many scripts that backup to a binary .bak file, but I can't find any that dump as a sql text file.

How do you do this in Powershell?

share|improve this question
5  
This looks like what you're looking for: blogs.technet.com/b/heyscriptingguy/archive/2010/11/04/… –  Thomas Stringer Dec 26 '12 at 19:08
    
What are you looking to dump? Data, schema, objects? Yes, no, all? –  billinkc Dec 27 '12 at 18:10
    
@billinkc I would like to dump all but the data. –  user16527 Dec 28 '12 at 17:53
1  
In essence, you'd like to mimic the functionality that is available through SSMS wherein you right-click on a databases, Tasks, Generate Scripts and then script all? It would seem the linked article by @sqlvariant/aaron nelson's is exactly what you're looking for. Is there something it does that doesn't satisfy your needs? –  billinkc Dec 28 '12 at 17:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.