Showing posts with label explorer. Show all posts
Showing posts with label explorer. Show all posts

Friday, March 30, 2012

How to script out my .mdf database I have in Visual Studio?

I'm using Visual Studio 2005 Standard. I have an .mdf database inside my Visual Studio "Server Explorer" under "Data Connections."

How do I script out this database, including the stored procedures in it? In other words, I want to export a SQL script that will create this database.

I'm very much a newbie when it comes to working with database management. I thought I created this .mdf inside my local install of SQL Server 2005 Express, but maybe I did it somehow inside Visual Studio in the Server Explorer. When I open up SQL Server Management Studio Express I don't see this database. I did locate the .mdf on my local C drive but I haven't been able to get Mgt Studio to open it.

Hi hapax_legomenon,

I use the Database Publishing Wizard to script my databases. You can select schema, data, schema and data, and be selective about which database objects you want and don't want. Microsoft wrote it, it's free, and on my list of "must-have" utilities. Here's the URL:

http://www.codeplex.com/sqlhost/Wiki/View.aspx?title=Database%20Publishing%20Wizard

Joe

|||

That's a great tool. Thanks!

Monday, March 26, 2012

how to save a stored procedure with Management Studio?

Hi,

i can make and save a stored procedure in Visual Web Developer (via Database Explorer). It appears then in the list op stored procedure in Management Sudio.

But how to do the same in Management Studio? When i make a sp and i want to save it, Management Studio asks me a name, but put the file in a Projects directory in 'My documents'. It never appears in the list of sp.

Thanks

tartuffe

Simple execute the script. When you make a SP in SSMS, it generates the "Create" or "Alter" statement, so executing the script will not execute the stored procedure, it will create or alter it, accordingly.

|||

Hey,

Try clicking execute instead of the save icon, as the two work differently. Management Studio uses Execute to actually execute against the database, where VWD uses the save button to perform that action, for whatever reason that may be.

|||

Thanks, it works.