Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

free utility to script DB objects in ms sql

I'm trying to implement database source control.

the tool I need should create a separate file for each object in the database, preferably arranged in folders, like

stored procedures functions views tables

and it would be great being able to also dump the results of certain queries, in order to keep track of the data changes in several configuration tables...

I wonder if there's is already a tool that can handle this kind of stuff...

--

just to clear a few things...

I'm already using sql delta to handle the update scripts...

I'd like to have scripts of the DB in order to use with subversion, so I can trace what objects where changed with each commit, without having to study the update scripts...

I'm developing a nice vb script with SQL Distributed Management Objects (SQL-DMO), I'll tell how it goes...

What's good about having my own solution, is that I can also include the outputs of queries or stored procedure execution, to trace the changes in certain tables, server configuration, the growth of the database, well, whatever I can dump to a text file...

like image 941
opensas Avatar asked May 07 '09 06:05

opensas


People also ask

How do you generate scripts for database objects in SQL Server?

Open the SQL Server Management Studio. In the Object Explorer, expand Databases, and then locate the database that you want to script. Right-click the database, point to Tasks, and then select Generate Scripts.

Which is the best free SQL query tool?

DBeaver is a free and open-source option for an SQL editor. DBeaver is an open-source database management tool, which has a pretty neat SQL editor. It is free, cross-platforms, and also provides an Eclipse plugin if you use the Eclipse IDE for development.


1 Answers

I use ScriptDB for exactly this purpose. The only thing I had to change was to remove the date of scripting in the generated files. Otherwise files are always marked as changed in Subversion.

Here is the batch I use. svnclient is the tool from codeplex svncompletesync.codeplex.com, to check in all files from a folder into subversion.:

svn checkout "http://svn/myproject" D:\Projekte\db_svn\myproject

ScriptDB "D:\temp\scriptdb" myserver mydb mylogin mypwd

del "D:\Projekte\db_svn\myproject\Schema Objects\\*.sql" /q /s

xcopy "D:\temp\scriptdb\myserver\mydb\Schema Objects\\*.sql" "D:\Projekte\db_svn\myproject\Schema Objects" /e /y /i

svnclient "D:\Projekte\db_svn\myproject" -m "commit durch svncompletesync"

like image 157
Mathias F Avatar answered Oct 13 '22 00:10

Mathias F