There are many code samples and sample databases available for Microsoft SQL Server. These samples are no longer shipped in the box. Instead, you can browse through and download the samples in several different projects on CodePlex.com. There is a portal samples project which directs you to all the other SQL Server sample projects on CodePlex: http://www.CodePlex.com/SqlServerSamples.
Installing Samples
On the Releases tab of the portal samples project you'll find installers for the complete set of product samples. You can also navigate from the portal page to particular technology sample projects for SQL Server (Analysis Services, Database Engine, etc.) which each have smaller installers just for those particular technology areas.
In the particular technology sample projects you don't need to install the sample to browse through the source code. Click on the Source Code tab and browse through the tree of source code just by clicking on folders and files.
If you choose to install the samples, by default, the sample files are installed in the following location: C:\Program Files\Microsoft SQL Server\100\Samples\technology_name
.
Make sure that you read and follow the installation instructions in the Readme files that accompany the samples that you want to use. For a list of samples, see the topic "Samples" in SQL Server Books Online.
The official sample databases for Microsoft SQL Server are located in the Product Sample Databases project: http://www.codeplex.com/MSFTDBProdSamples. The installers are located on Releases tab.
The portal sample project also contains links to community based sample projects which are not considered part of the product but which you may find very useful.
Providing Feedback
CodePlex provides a direct way to report issues and ask questions about the samples for each technology area. Use the Issue Tracker tab to report problems and check on the status of issues you have reported. Use the Discussions tab to discuss various sample ideas, give us feedback about existing samples, or ask questions about the samples.
Updating the Location for .NET Framework CLR Samples
Before you compile Microsoft .NET Framework common language runtime (CLR) samples for SQL Server, verify that the path of the version of the .NET Framework compiler is the first Framework directory in the PATH environment variable. The location of the compiler that is shipped with this release of SQL Server is C:\Windows root directory\Microsoft.NET\Framework\v2.0.x. Drive C is the installation drive, Windows root directory is either Windows or WINNT, and x is five digits.