1 – The Microsoft SQL Samples MSI installs over 100 samples in 6 major categories: Analysis Services, Engine (includes Administration, Data Access, Full Text Search, Common Language Runtime Integration, Server Management Objects, Service Broker, and XML), Integration Services, Notification Services, Replication, and Reporting Services. There is also a directory “Integrated Samples” for the two multiple feature samples, HRResume and Storefront. Each individual sample has its own readme file, which is also included in the Microsoft SQL Server Books Online. Most samples contain a directory structure similar to the following, with the C# files in a CS folder, the Transact-SQL files in a Scripts folder, and the Visual Basic files in a VB folder:
SampleName (usually includes the readme only)
CS (includes the solution file)
ProjectFolder1
ProjectFolderN
Scripts
VB (includes the solution file)
ProjectFolder1
ProjectFolderN
2 – Make sure you read the readme file in the sample directory. It will tell you the prerequisites for the sample as well as the steps to build and run the sample.
3 – To install the samples and sample databases from the SQL Server Setup, you need to click the Advanced button on the Components to Install page, then expand Books Online and Samples and select Samples. This only installs the Samples MSI on your machine. To complete the installation, you need to run the Samples MSI. You can do this from the Start menu: click All Programs, click Microsoft SQL Server, click Documentation and Tutorials, click Samples, and then click Microsoft SQL Server Samples.
4 – Most samples assume that you installed them in the default location (drive:\Program Files\Microsoft SQL Server\100\Samples). If you choose a different location, you’ll likely have to change the code in order for a sample to work.
5 – Many samples require the AdventureWorks sample databases. You can install these during SQL Setup, or you can download them from the
6 – Many samples require .NET Framework 2.0. If you don’t have Visual Studio 2005, you can download the .NET Framework SDK 2.0 at http://msdn.microsoft.com/netframework/downloads/
7 – Some samples use the CLR integration feature, which is off by default. Use the SQL Surface Area Configuration tool to enable CLR integration. This can be found in the Start menu: click All Programs, click Microsoft SQL Server, click Configuration Tools, and then click SQL Server Surface Area Configuration.
8 – Some samples will not work in the SQL Express edition because certain product features, including Analysis Services and Integration Services, are not available. You will need to purchase the Standard or
9 – Many samples require you to create a sample key file before they can be successfully compiled. See the sample’s readme file for exact instructions. For most samples in the RTM release, you will need to do the following:
a. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft Visual Studio 2005, point to Visual Studio Tools, and then click Visual Studio 2005 Command Prompt.
-- or --
Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
b. Use the change directory (CD) command to change the current directory of the command prompt window to the sample folder, such as <system_drive>:\Program Files\Microsoft SQL Server\100\Samples\Engine\Programmability\CLR\HelloWorld
c. At the command prompt, run the following command to generate the key file:
sn –k keypair.snk
For samples updated after RTM, most of the samples use the same key file. To generate a strong name key file:
a. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft Visual Studio 2005, point to Visual Studio Tools, and then click Visual Studio 2005 Command Prompt.
-- or --
Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
b. Use the change directory (CD) command to change the current directory of the command prompt window to the folder where the samples are installed.
Note: To determine the folder where samples are located, click the Start button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.
c. At the command prompt, run the following command to generate the key file:
sn –k SampleKey.snk
10 – Samples are not intended to be used in a production environment; however, you are free to re-use sample code in your applications.
联系客服