I want to export all of my SQL Server data, DML, procedures, etc from my database in the format of an SQL script that will recreate everything (similar to pg_dump for Postgres). I am running SQL Server in Docker, so I need an approach that works from Mac. I tried using the T-SQL BACKUP statement, but that exports in a binary format.
Add a comment
|
1 Answer
Microsoft has a tool called mssql-scripter that does this. With it, you can do:
mssql-scripter -S localhost -d MyDB -U MyUser -P MyPassword --script-create > ./schema.sql
3 Comments
Zohar Peled
While self-answered questions are a good thing, this answer is only a little more than a link. with 18K reputation, I would expect you can do better then that.
acjay
@ZoharPeled The only reason I posted this is in case someone finds themselves in the same situation. My goal was to make the information discoverable via the sort of searches I attempted. But the solution did end up being really easy, after much time spent discovering it. I'd gladly make this more detailed or helpful, if you have suggestions on how to do so. Scolding me without a suggestion is not very helpful, though.
Zohar Peled
Just include some relevant content from the page you've linked to, that's all