Showing posts with label Sample databases. Show all posts
Showing posts with label Sample databases. Show all posts

Friday, February 24, 2017

WWI a new sample database with SQL Server 2016

There have been a number of sample databases that debuted with various SQL Server versions starting from pubs, Northwind, Foodmart and AdventureWorks

Northwind employees have been in the limelight for years and it is time for them to retire. Some 9 employees managed the whole business and now businesses have gone global and IOT and robots are standing in queue.

In this background Microsoft has introduced the Wide World Importers, WWI for short. You can get an overview here , or read on.

This is how Microsoft describes WWI's business:

"Wide World Importers (WWI) is a wholesale novelty goods importer and distributor operating from the San Francisco bay area.

As a wholesaler, WWI’s customers are mostly companies who resell to individuals. WWI sells to retail customers across the United States including specialty stores, supermarkets, computing stores, tourist attraction shops, and some individuals. WWI also sells to other wholesalers via a network of agents who promote the products on WWI’s behalf. While all of WWI’s customers are currently based in the United States, the company is intending to push for expansion into other countries.

WWI buys goods from suppliers including novelty and toy manufacturers, and other novelty wholesalers. They stock the goods in their WWI warehouse and reorder from suppliers as needed to fulfill customer orders. They also purchase large volumes of packaging materials, and sell these in smaller quantities as a convenience for the customers.

Recently WWI started to sell a variety of edible novelties such as chilli chocolates. The company previously did not have to handle chilled items. Now, to meet food handling requirements, they must monitor the temperature in their chiller room and any of their trucks that have chiller sections."

In an importing and redistributing business the Workflow is very well defined to address all exigencies and so it is with WWI as charted by Microsoft:

Workflow of stocks:

    WWI creates purchase orders and submits the orders to the suppliers.
    Suppliers send the items, WWI receives them and stocks them in their warehouse.
    Customers order items from WWI
    WWI fills the customer order with stock items in the warehouse, and when they do not have sufficient stock, they order the additional stock from the suppliers.
    Some customers do not want to wait for items that are not in stock. If they order say five different stock items, and four are available, they want to receive the four items and backorder the remaining item. The item would them be sent later in a separate shipment.
    WWI invoices customers for the stock items, typically by converting the order to an invoice.
    Customers might order items that are not in stock. These items are backordered.
    WWI delivers stock items to customers either via their own delivery vans, or via other couriers or freight methods.
    Customers pay invoices to WWI.
    Periodically, WWI pays suppliers for items that were on purchase orders. This is often sometime after they have received the goods.

You will be hearing more about WWI in my blogs:
http://hodentek.blogspot.com
http://hodentekMSSS.blogspot.com
http://hodentekHelp.blogspot.com

The next tasks for you are:
Apply SP1 before you construct a database (WWI):

http://hodentekmsss.blogspot.com/2017/02/download-and-apply-sql-server-2016-sp1.html

Construct WWI database on the named instance by any of the following methods:

http://hodentekmsss.blogspot.com/2017/03/using-bacpac-file-to-construct-wide.html

http://hodentekmsss.blogspot.com/2017/02/constructing-wide-world-importers.html




Wednesday, January 30, 2013

How do I install a sample database using script?

When you are working with SQL Servers you may want to use database samples. Microsoft has published sample databases from time to time. Some of the databases published are,

Pubs
Northwind
Foodmart for OLAP
Adventure Works of various types.


These database samples comes in two forms; MDF & LDF files or script files which when run on the server installs the databases. The MDF and LDF files can be used to install the samples using either the Graphic User Interface (Right Click Databases node in the SQL Server Management Studio and choose Attach...) Attach menu item on SQL Server, or using T-SQL Scripts.

For SQL Server 2000 database files please follow this link: http://www.microsoft.com/enus/download/details.aspx?id=23654

For Adventure Works database files please follow this link: http://msftdbprodsamples.codeplex.com/releases

Make sure you get both the MDF and LDF files as both are needed while attaching the databases, read the following comments here, http://msftdbprodsamples.codeplex.com/workitem/19203.

For attaching the MDF / LDF files follow this link for step-by-step procedure here:

Here the use of script file to install the sample on SQL Server 2012 is demonstrated. Note that the original documentation mentions that Northwind (2000) can only be installed on Windows 2003 and Windows XP, but you can install them on a Windows 7 machine.

From the link mentioned earlier for Northwind you can download the SQL2000SampleDb.msi file to a location of you choice.
Double click the MSI fileshown here,




Double click SQL2000SampleDb.msi in the download folder location to open






Click Next and agree to license terms on the next widow that is displayed. Click Next.



Click Next.



Click Next.




The database scripts as well as mdb / ldb files will be created in C:\SQLServer2000SampleDatabases as shown.


Connect to SQL Server 2012 and create an empty database Northwind
Click File | Open |  File...
The instnwnd.sql file opens in a query window. Check Syntax.


Click Execute.
You may get the message like:

Msg 2812, Level 16, State 62, Line 2
Could not find stored procedure 'sp_dboption'.
Msg 2812, Level 16, State 62, Line 3
Could not find stored procedure 'sp_dboption'.

Comment out the sp_dboption as shown as it is deprecated in SQL Server 2012.

--exec sp_dboption 'Northwind','trunc. log on chkpt.','true'
--exec sp_dboption 'Northwind','select into/bulkcopy','true'

Click Execute

The Northwind database will fully populated as shown:



Enjoy!

Mahalo














Saturday, August 7, 2010

Installing AdventureWorks Sample Databases

AdventureWorks  is one of the common sample databases used in Microsoft Database related programming or, in Visual Studio applications. What started off as a single database has grown into a big family and together with this, the installation procedure has undergone a lot of changes. The days of attaching and detaching sample database files are gone. The WinZip installer kicks off the installation.

Recently I wanted to work with PHP training kit which required a SQL Server 2008 Express with a AdventureWorks database. The download link on the Configuration Wizard-PHP on Windows Training kit took me to a dead end (Trust me this happens a lot with Microsoft documentation). Finally, I thought just that any AdventureWorks would do and downloaded the AdventureWorks2008R2_RTM.exe (82.3 MB ) from CodePlex site and installed it on the brand new SQL Express 2008 (SQLEXPRADV_x86.enu.exe). Although it did not provide the right (Which, I don't know what? As yet) AdventureWorks, I could see how the installation procedure has changed.

The installation took 35 minutes. It took 100% of the CPU and 76% of physical memory during installation and installed a bunch of AdventureWorks databases for all kinds of end users. Here are some screen shots of the installation.






















Look at all the AdventureWorks databases in this image.











































Friday, May 14, 2010

Using sample databases with SQL Server 2008 R2 Nov-CTP

Often times you may want to test something simple and you don’t want to create a database of your own. You can use Microsoft relational database samples. These samples are available for most versions. Recently samples are not bundled with the servers and you may have to get them from online sources.

After downloading the samples you must attach them to the SQL Server as these are Data and Log files. This article shows you the steps involved for attaching a Northwind database to SQL Server 2008 R2 Nov-CTP, but the procedure is the same for other versions as well. Additionally you can also use sp_attach_db and sp_detach_db stored procedures to attach/detach the databases.

Note: Download the SQL Server 2000 Sample DBS as well as Microsoft Sample Databases from the CodePlex site here:


http://sqlserversamples.codeplex.com/#databases


For SQL 2005 (top right of the URL) and SQL Server 2008 R2 databases you go to this URL:


http://msftdbprodsamples.codeplex.com/releases/view/37109

Attaching a Northwind Database to SQL Server 2008 R2

We will attach a Northwind database from SQL Server 2000 samples to the SQL Server 2008 R2 Nov-CTP


Download the SQL Server 2000 Northwind and Pubs databases ZIP file [SQL2000.Sample.Databases.(Northwind,pubs) zip file, 1.202MB]

http://code.msdn.microsoft.com/northwind/Release/ProjectReleases.aspx?ReleaseId=1401

Unzip to a folder of your choice.

Folder structure is shown here:








Right click databases node in SQL Server 2008 R2 Nov-CTP's SSMS (SQL Server Management Studio) to display the following:


When you choose attach drop-down menu by clicking the menu item you will display the following


Click Add… in the top of the window and it will take you to the default location of your database files as shown.


If you did not unzip the files to this location you can also browse folders on your machine to locate them as shown.


Now click on Northwnd.mdf to highlight it and click OK

This brings in both the mdf [data]and ldf [log] files to the Attach windows as shown.

Click OK and after processing your request, Northwind database will appear in your server as shown.


For moving data from SQL Server 2000 to 2005 read this popular article here [0.5 million page views]

When Identity Security Becomes a Wall — Not a Shield

After a breach that forced a reset of my digital identity, I hit a roadblock I never anticipated: multi-factor authentication (2FA) locked m...