Tools to generate SQL DDL and Content from an existing database - sql-server

Does anyone know of a reasonably priced tool that will create DDL statements to create a SQL Server database and appropriate Insert statements to recreate the data? I use the Red Gate tools to do database compares (including content compares) and this comes close (I could always compare with an empty schema) but I was wondering if there was a tool that others found useful that did this in one step.

Late answer... hopefully someone will find it useful…
There is a tool from Red Gate called SQL Multi Script that can do scripting for what you need. Not sure if it existed when the question was asked though :)
Another good piece is SQL build tool from ApexSQL which can also do all kind of insert and other scripts…
Disclaimer: I’m not affiliated with any of the companies mentioned above.

Have you had a look at SQL Publishing Wizard? It will create all the DDL statements you require for all database elements (tables, views, SPs, users etc).
If you're using SQL 2008, it comes built into the management studio. More info on 2008.

SQL Publishing Wizard
Saw Austin Solonen post this tool in a somewhat related thread. Express editions appearantly don't hove Import and Export.

The database publishing wizard that is included in Visual Studio 2008 performs this function.
It is also available via CodePlex as an add-on for prior versions of Visual Studio.

Related

Will Visual Studio 2010 Deploy SQL DB Schema Updates?

I have, admittedly, done very little searching on my own, so feel free to insult and/or harass me.
I have two databases that I use, one for development and one for production. In Visual Studio 2010, I have simple overrides that change the connection string based on whether I'm building for Debug or for Release.
Right now, I manually change the database schemas when needed. I've thought about creating scripts, but I'm wondering if there is a better way? Can I create a DB in Visual Studio on my local computer, migrate those changes to the development SQL and then, finally, migrate up to Production so that the schema version matches the release?
Thanks in advance!
.NET 4 | Visual Studio 2010 | MS SQL Server 2008
Are you familiar with Visual Studio Database Edition? It's reason for being is to help you with what you just described. Not only does it allow you to version control your database schema, it allows you to build deployment T-SQL scripts to update a database from one version to another. It has built in schema compare and data compare. I highly recommend it. We use it to version control our database schema and to do deployments. I would never attempt to update database schemas by creating manual scripts anymore.
This used to be a pain in the ass for me. Then I bought this: http://www.red-gate.com/products/sql-development/sql-source-control/
Which, providing your're using a compatible Source-Control solution (such as SVN), you can make changes in one database, commit them, and then update other databases with the same structure.
As Randy mentions, the Database Edition of VS.NET will do this.
I use SQL Delta. It's a third party tool and very well priced for what it does. I've used it for a number of years on extremely large projects (that is the database has hundreds of tables and thousands of stored procedures) and it has never failed us in what it does.
The way I used it is this.
I get it ot produce a blank database
schema as per the development
database.
Move this database over to
the production server
Sync the production database with this database
You can also produce scripts and run the scripts and all of this can be automated.

SQL Server: pushing development to production?

I'm currently using SQL Server Management Studio.
I have a development database, and access to a live database.
I just want to able to migrate my development tables to the live server.
I'm consulting stack flow first, since I don't want to blow anything up.
If you know what tables you want to migrate and they don't yet exist on the prod server, it's as simple as scripting the table definition, then running the script on the server. If it's more complex than that, I would recommend any number of tools which compare database schemas and automatically generate scripts you can run on the destination server to add/alter/remove what you need. A good freeware one for simple jobs is DBComparer. It's pretty basic. An excellent commercial one are the Sql Tools by Red Gate
We are using SQL Examiner Suite for this, but there are a lot of similar tools.
This is worth a look at - I've used it before and it works well and is very easy: Microsoft SQL Server Database Publishing Wizard http://www.microsoft.com/downloads/en/details.aspx?FamilyId=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en

SQL Server Extract Data Model

Is there a simple way of extracting the database model of existing DBs? I played around in the management studio and in Visio, even though I found very interesting features of data integration I failed to perform a simple export of the structure of the DB.
Could anyone pls give me a hint how to perform such an export, basically I only need the table and view names and their fields in a Visio or Enterprise Architect readable format.
thx in advance
K
Exporting schema is easy with Tasks->Generate Scripts...
but wheter you can use it with Visio - no idea.
First,
thanks guys for the presented hints.
I figured around and found that Visio 2k7 has a pretty easy to use
DB reverse engineering functionallity which actually resolved my
problem. It works with MS SQL and also with ODBC.
To make it short: Visio ships with the needed functionallity,
Enterprise Architect 7.1 has a quite similar functionallity
which makes use of ODBC too.
K
Select the "Generate Scripts" option from your Object Explorer:
and then make sure to pick "Generate all objects" from the Script Wizard:
This allows you to create a single SQL file to create the whole database, and at least Visio Enterprise is able to reverse-engineer a database from a SQL script.
Marc

Stored Procedure Versioning

How do you manage revisions of stored procedures?
We have a BI solution on SQL Server 2005 with hundreds of stored procedures.
What would be a good way to get these into Subversion? What are your recommended tools to script stored procedures to files?
There are doubtless a bunch of off-the-shelf products you could buy (I think a few RedGate tools might come in handy here), as well as Visual Studio Team Suite - Database Edition.
In light of purchasing something, why not consider using SQL Management Objects (SMO)?
I've written a couple of utilities which generate T-SQL scripts (using the Scripter class) which produces the same scripts you get from generating scripts through the SQL Server Management Studio (it uses the same functionality).
You could integrate such a utility into a build script/build process which would allow you to generate scripts and then version & check them into a source repository. Plus, you can batch the scripts into a single file (if desired) which beats maintaining hundreds of individual files.
I wrote a blog entry about this approach a while back.
Check out more on the SMO class Scripter
Here's a few more entries which might be useful:
http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated
http://sqlblog.com/blogs/ben_miller/archive/2007/10/03/table-scripting-with-smo-part-1.aspx
See here and here for a start.
Please check out here What is the best way to version control my SQL server stored procedures?. Might help you identify couple of solutions to this issue.
I have previously used a Visual Studio Database Project to manage create table scripts, stored procedure scripts etc. I'm fairly sure you could then use subversion to manage these files in the same way as any Visual Studio project.
I used the built in functionality for scripting the procs, but i'm sure Redgate would have some tasty tools for that.

Fast SQL Server 2005 script generation

It seems like the generation of SQL scripts from the SQL Server Management Studio is terribly slow. I think that the old Enterprise Manager could run laps around the newer script generation tool. I've seen a few posts here and there with other folks complaining about the speed, but I haven't seen much offered in the way of alternatives.
Is there a low-cost/free tool for scripting an entire SQL Server 2005 database that will perform better that SSMS? It would be hard to do worse.
See the Database Publishing Wizard that is part of the SQL Server Hosting Toolkit. It generates a single SQL file for both schema and data.
We are using the tools by RedGate which I personally find very useful in any aspect of work with databases. For scripting I would recommend the SQL Compare (you need a pro version for scripting). The SQL Compare is a must have for deploying schema changes from the deployment DB to the live Server and a real timesaver.
Those tools are not free but I think they could save you money in a long run
What kind of scrpt generation are you talking about now?, generating create scripts from the objects in the database is way faster in SSMS compared to EM.
But if you are running an select or something that gives you lots of rows in the grid, it is crazy slow.. like scripts generating inserts statements of all rows in an table, if you got lots of data, it is almost not doable.
I don't know what is "terribly slow" for you, but I have a decent performance with SQL 2005 Management Studio. In either case, RedGate products are very cool. Unfortunately they are not free.

Resources