Monday, February 20, 2012

MSDE Examples?

Does MSDE have the PUB database example in it? Just wondering before I download it.I guess all I need to know is instpubs.sql included during the install? Could someone do a quick search of their harddrive that has MSDE installed? If not, I guess I can stop being lazy and download it.|||Ok, since no one answered I went and installed MSDE. I found it doesn't have the pubs automatically but you can easly download the scripts from Microsoft. The installtion was easy and I found a really cool way to build the pubs sample database. I will share the instructions which I got from Peter Wright. Author of ADO.NET Novice To Pro, From Apress Inc.

-------------

That's a problem isn't it, and one that caught me out initially. MSDE is a great tool, since it's basically a cut down SQL Server, for free, but without a user interface how on earth do you do anything?

The solution lies in Visual Studio, and hopefully this applies as much to the standard editions as it does to the Enterprise edition I have here.

Click on File, and then on New Project. When the project type browser appears, click on "Other Projects", and you should see an entry that says Database Projects. Click it, and call your project PubsDatabaseSetup.

You'll instantly get presented with the Data Link dialog, a dialog asking you to basically build up the connection string to talk to your database server. Now we're getting some where - Visual Studio wants access to your MSDE database, so key in your username, machine name (localhost) and so on to let it have access. The dialog will also ask you for a database name - leave it blank.

When the project has been created you'll notice in the Solution explorer that you have folders for Change Scripts, Create Scripts and Queries. Drop your InstPubs.sql script file into the Create Scripts folder - you can do this by right clicking on the FOlder and choosing add existing item from the list that appears.

Finally, to run the script, right click on it and Choose RUN.

Your database will be created, but more useful than that is the fact that you now have a project that can be used to maintain the database. If you want to add any new stored procedures you can do so with this project. If ever you need to rebuild the database y ou can use this project to do just that.

Database projects in Visual Studio are a very powerful tool indeed. Have fun exploring them
------------

No comments:

Post a Comment