Sunday, March 25, 2012

Exporting Database Schema

Is there a way for VS2005 to export the database schema of a .mdf into a .sql file? Preferably from a Web PRoject, not a Database Project, but right now I am anything but picky, so whatever works.

Thanks.

It is not export because with a .sql file you are just generating a create database statement, you right click on your database in Management Studio and click on create to generate the create database statement. This is the way to do it because VS is to create DML(data manipulation language) like queries but create database is different it is DDL(data definition language). Hope this helps.|||

You should be able to do this easily in Management Studio: right click a database->Tasks->Generate Scripts->Finish the wizard.

|||It is the SLQ Managment Tool you two are refering to, right? Does that mean that I need the Express version, or is it somewhere I can't find it as I am using the full VS2005 package?|||

You can download the Management Studio from this link:

http://msdn.microsoft.com/vstudio/express/sql/download/

|||

Yeah, I know, I was just double checking. Thanks.

One follow up question though. I have it installed, but it can see only the .mdf files that are within the database project files, is there a way to make it see the ones I have in my Web Projects?

|||Right click "Database" and choose "Attach". Pick your .mdf, and then you can see it. Just make sure to unattach when you are done, or your web app won't be able to access it.sql

No comments:

Post a Comment