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
Related
Fellow Developers I have been working on creating a Database with SQL Server 2005, now I finished that step, its a huge and massive one. Now the company wants me to export their data from their Access 2007 db to this sql 2005 database I created.
I know that I will be using field mapping, but is it actually possible to do that ?
Any Suggestion ?
A major portion of my job is converting data from one data source into another. I am actually doing a Filemaker Pro to SQL Server conversion right now. I have tried some of these Automatic solutions and they are hit or miss depending upon the complexity of the data involved. Usually, I do it by mostly by hand writing scripts (I do automate some of the scripts using a VB6 application I created many years ago).
I have found that doing the scripts by hand always produces the best conversions.
This fellow describes how he did it. There is a tool called "SQL Server Migration Assistant (SSMA) for Access" that you can download from Microsoft. The blog also has a Word document that you can download for a step-by-step description of what to do.
You can download SSMA here and possibly just figure out how to do it without searching further.
It depends on the complexity of the import. Try using SQL's import wizard first. If that's too limited, you may need to create an SSIS package.
I'm planning to use source control for SQL Server database. I have different versions of SQL Server (2005 and 2008) running on different machines (Windows 2003 and 2008). I looked up about source control and found out 2 options.
http://nobhillsoft.com/Randolph.aspx
http://www.red-gate.com/products/sql-development/sql-source-control/
So I was just wondering if someone have experience with them and suggest me which one would be good out of these or any other better option?
Thanks!
In my opinion, you may be approaching something here from the wrong angle. If you try to revert a change to the table structure, but the table has been populated with data fitting the new table structure, what happens? It's more complex than maintaining plaintext diffs. I encourage you to really look at the idea and see if you can accomplish this another way, and document your database design as completely as possible every time you need to change it.
That being said, here are some more ideas.
http://www.sqlservercentral.com/Forums/Topic753558-361-1.aspx
http://www.sqlservercentral.com/Forums/Topic635185-145-1.aspx
I compare all these options and going with Red-gate source control and data source solution. Thanks for all suggestions!
You can use your current version control system if it's suitable for you to store only installation SQL script of a database.
Use SSMS to produce installation script: right-click on desired databased, select Tasks -> Generate Scripts... Script Wizard will start and help you to script any objects you need in the database including data. Save this script under your version control system since it's text file.
Use this database installation script to reproduce the database at desired location and environment.
What are the option in terms of applications that help build SQL statements against a SQL Server database?
We have some users that need to build SQL statements, preferably through drag and dropping or linking up tables etc.., against a SQL Server databse who don't have any experience in this area.
Any Ideas?
Visual Studio 2008 / 2010 have this featue and works well. I mean LINQ to SQL or Entity Framework, but in bigger projects I dont prefer Entity Framework.
The Sql Query editor in sql server 2005 and above is very good for that sort of operation. I found that the combination of drag and drop columns with the sql instructions below helps non-sql developers learn a little about sql and tends to wean them off of the editor.
I actually just ran into this problem in my own project.
One option is to purchase a tool that does precisely what you're looking for. If you do something like that, you're more likely to get something that's full-featured, well-supported, and has a lot of nice bells and whistles to make your job easier.
However, as both Svisstack and george9170 pointed out, there are already tools within the Visual Studio development environment. Here is how I'm proceeding:
I use Microsoft SQL Server Management Studio's Diagram editor to perform the dragging and dropping of tables. This works fairly well, although it's a bit more cumbersome to work with than some of the tools I investigated. (For the record, the reason I didn't use the tools I investigated was the cost.)
Once I develop the tables in the diagram, I tell MSSMS to generate the tables.
I then use the Database Publisher (it comes with VS2008 and VS2010) and I connect with the database. Using LINQ to SQL, I let the magic work behind the scenes so that I can utilize the various objects which will interact with the database.
If I'm not explaining this well, check out the two links below. It should make things more clear.
Using Database Projects for Visual Studio
NerdDinner - An ASP.NET MVC tutorial, but with good information on LINQ to SQL.
By using LINQ to SQL (as described in the second link), your users should be able to build queries against the database fairly easily. It's not drag and drop, but it's very simple and straightforward.
First, I hope they are not doing their queries against a production database!
For regular non developers, try using excel, for these reasons:
1) most generic users might have it on their PC already.
2) drag and link tables. There is a little GUI for simple drag and link tables in there.
3) Support. When they get into trouble, they can e-mail me the file and I can see what they have so far. I'll end up writing views or procedures for them to use.
4) They can use the results data using familiar excel interface and functions, which helps since their SQL ability is so limited.
For developers these GUI tools are extremely limited in what you can do with your queries. I've never found one that can do UNIONs, derived tables, or CTEs. I'm not sure if any can even do OUTER JOINs. For simple tasks, they might be ok, but to switch back and forth all day would be a pain, so I just type them up.
You can use Access databases as well. They let you form your own queries by dragging and dropping in Access 2010. However, if you are looking for easy to access data without the worries of SQL syntax, you might want to look at using Ruby ActionViews. If you are talking about live editing of the entire database if the database is of any importance (you can easily delete or clear an entire database on accident), I would do it in pure SQL, or better yet, not do this at all. If you are using MySQL, you should look at the possibility of using phpmyadmin for maintaining your database. It is a web based tool that makes database administration easy and can help you form your queries.
Right now all I did was use the Dataset designer and dragged tables into it from the Database Explorer. It works (for what I need anyway) but it feels like it's a misuse of Datasets. (Actually I'm not really sure how to use Datasets or what the intended usage is, I was planning on using LINQ2SQL to interact with the DB)
Is this ok? I only need it for the designer view and it's a very simple DB layout (just 4 tables). I'm sure there's other tools out there, but is there anything integrated into VS Express that I should be using instead?
You download MS SQL Express with the SQL Studio Management Studio Express. Only in the Studio Express can you connect to the server, select the database, open the database diagrams and edit diagrams.
Then, you can drag and drop the entire set of Tables in to Linq to SQL. Entity Framework is nice, but I have yet to get it to render my tables well yet. I would stick to Linq to SQL until they release another upgrade to EF (easier for you).
You say it works, and you want just want to make a diagram, so go with it. You should make sure it doesn't build the generated code file, however, as it could cause bloat in your final product.
If you're not going to use it for code and it provides adequate output for you, what does it matter if it's a "misuse"? I know people who used Excel to design documents because it was easier to line things up that way. I would use Word, and it's clearly not Excel's stated main purpose, but does it mean using Excel was wrong?
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.