SQL Server Engine Samples

The BetaSQLServerEngineSamples.msi contains samples for Microsoft® SQL Server™ Beta 2.

Run the msi to extract the samples. If you do not specify otherwise, the samples are installed in C:\Program Files\Microsoft SQL Server 2005\90\Tools\Samples\1033\Engine.

All the samples will run on SQL Express unless noted in the description.  Use the following parameters with SQLCmd for executing transact-sql scripts:

·          SQLCmd –S servername\instancename –E –I –i filename.sql

These are the samples in the BetaSQLServerEngineSamples.msi.  Most of the samples have been developed in both C# and VB.Net.  Note:  to run the SMOPing sample, make sure you pass in the server name and instance with no space, for example:

·          SMOPing.exe –Sservername\instancename.

 

Technology

Name

Description

ADO.NET

Reading and Writing Large Binary Data

Programmatically reads binary data from a file into a database. Also retrieves binary data stored in the database and writes the contents to a file.

Full-Text Search

ItemFinder

Demonstrates new features in Full-Text Search, and best practices for locating data efficiently, caching, paging, and adding Large Object (LOB) data to the database.  Not supported in SQL Express.

Adventure Works Cycles Integrated Samples

HR Resume and Storefront E-Commerce site

The HR Resume sample allows the user to seach for and display XML resumes using relational and full-text techniques in a specific language.  Only basic functionality is provided in this release.  Additional features may be added in future releases.

The Storefront sample provides a traditional e-commerce shopping experience for the goods sold by the ficticious Adventure Works Cycle manufacturing, wholesale, and retail organization.  This sample demonstrates many different SQL Server 2005 technologies including SQL CLR, Service Broker, Business Intelligence, recursive queries, and various .NET Framework 2.0 technologies including ASP.NET 2.0.  Not supported in SQL Express.

Notification Services

Profit Margin

The Profit Margin sample is an event-driven Notification Services application that produces notifications about profit margins for individual employees and sends this data to subscribed users. This sample uses the Analysis Services event provider to query an Analysis Services database and return the results as events to the Notification Services application.  Not supported in SQL Express.

Notification Services

Flight

The Flight sample is an event-driven Notification Services application that produces notifications about flight prices for subscribed users according to their subscriptions.  Not supported in SQL Express.

Notification Services

Newsletter

The Newsletter sample shows how to create a simple Web-based subscription management application. The sample has an n-tier design containing an HTML-based interface layer and a subscription management middle-tier layer. A Visual Studio Web project creates a Visual Web Developer Web Server when you run the Web project so that you can more easily use the sample.  Not supported in SQL Express.

Notification Services

Stock

The Stock sample is a Notification Services application uses both event-driven and scheduled subscriptions to produce notifications based on stock market data. Subscribed users receive notifications if the stock price goes above a specified trigger value.  Not supported in SQL Express.

Replication

MergeClient

This sample highlights how a merge replication topology can be implemented to deliver data to mobile users, and it also demonstrates the programmability features of merge replication in SQL Server 2005. The sample is a Windows Forms-based application that uses standard Microsoft data access technologies and merge replication to enable a salesperson to maintain local data while synchronizing periodically with the home office.  Not supported in SQL Express.

Service Broker

HelloWorld

This sample provides a small example that sends and receives a message using Service Broker. The sample creates two services and sends a message from one service to the other. The sample includes a script that receives and displays the message.

Service Broker

EventLogging

This sample shows you how to use Event Notifications to log events in SQL Server. The sample creates a service that receives event notifications and a service program that receives the event notification messages and logs the information in the messages. The service program demonstrates two different ways to log event notification messages. One approach extracts important information from the event notification message and saves the key information and the original message in a log table. The other approach extracts all of the information from the event notification message, saves this information in a log table, and discards the original message.

 

Service Broker

NewCustomer

Creates an application that performs asynchronous processing when a customer is added to the AdventureWorks database.

SQL MANAGEMENT OBJECTS (SMO)

BackupRestore

Demonstrates how to backup and restore a database. 

SQL MANAGEMENT OBJECTS (SMO)

ManaageDatabases

Demonstrates how to create, alter and drop a database.  Includes adding a new file group and log file.  

SQL MANAGEMENT OBJECTS (SMO)

CreateStoredProcs

Demonstrates how to create a SELECT stored procedure for each table in the selected database. 

SQL MANAGEMENT OBJECTS (SMO)

ManageTables

Demonstrates how to create, alter and drop tables. 

SQL MANAGEMENT OBJECTS (SMO)

ManageUsers

Demonstrates how to add, modify, and remove users. 

SQL MANAGEMENT OBJECTS (SMO)

LoadRegAssembly

Demonstrates how to load and register a .NET Assembly into SQL Server.  Uses the UtilityConversion assembly. 

SQL MANAGEMENT OBJECTS (SMO)

ScriptDatabase

Demonstrates how to script dropping or creating a database. 

SQL MANAGEMENT OBJECTS (SMO)

ServerConnect

Demonstrates how to connect to the SQL Server system. 

SQL MANAGEMENT OBJECTS (SMO)

ServerInfo

Displays a list of server and connection properties for the selected instance of SQL Server.

SQL MANAGEMENT OBJECTS (SMO)

SMOPing

A console application that connects to the selected instance of SQL Server and dumps selected properties.  Can be used to check the SQL connection. 

SQL MANAGEMENT OBJECTS (SMO)

SQLService

Displays the SQL Server services that are available to start, stop, pause, and resume.  Sample relies on WMI provider which is not supported in SQL Express.

SQL MANAGEMENT OBJECTS (SMO)

UtilityConversion

Used with LoadRegAssembly.  Contains demonstration CLR functions for use with SQL Server. 

SQL/CLR

AdventureWorks CLR Layer

The AdventureWorks SQLCLR Layer sample for Microsoft SQL Server 2005 provides some useful utilities which form an extra layer of functionality on top of the base AdventureWorks sample database. The first utility creates contact records for various types of people involved in the AdventureWorks database. The contact information is specified using XML and is passed to a C#-based stored procedure. The second utility defines a Currency user-defined data type using C#. This user-defined data type encapsulates both an amount and a culture which helps determine the correct way to render the amount as a currency value in that culture. The third utility provides a currency conversion function which returns an instance of the Currency UDT. If the AdventureWorks database has a conversion rate from USD to the correct currency associated with the specified culture, then the conversion function returns a Currency UDT with the converted rate and a culture that matches the culture requested. Otherwise a Currency UDT is returned with the original amount (which should be in USD) with the en-us culture. The utilities also demonstrate how to unregister and register common language runtime (CLR) methods and assemblies using Transact-SQL.

SQL/CLR

Handling LOB using CLR

Demonstrates transferring large binary objects between a Yukon database and files accessible to the server using CLR stored procedures. Also demonstrates registration and dropping of CLR stored procedures and assemblies, invoking CLR stored procedures, performing data access from CLR stored procedures, invoking Transact-SQL stored procedures from CLR stored procedures, and using a file to log errors during processing of server side code.

SQL/CLR

String Manipulate

This sample for Microsoft® SQL Server™ 2005 demonstrates the implementation of five T-SQL string functions which are surrogate aware other than built-in string functions. This sample shows the implementation of five T-SQL string functions that provide the same string manipulate functions as built-in ones but with additional surrogate aware capability to handle both Unicode and surrogate strings. The five functions are len_s(), left_s(), right_s(), sub_s() and replace_s() which equivalent to built-in’s LEN(), LEFT(), RIGHT(), SUBSTRING() and REPLACE() in string type functions.

SQL/CLR

String Manipulation (UTF8)

This sample for Microsoft® SQL Server™ "Yukon" demonstrates the implementation of a user-defined data type (UDT).  This sample shows the implementation of a UTF8 user defined data type that extends the type system of the database to provide storage for UTF8 encoded values.  This type also implements code to convert Unicode strings to and from UTF8.

SQL/CLR

CLR String Utility Sample

This sample contains a streaming table-valued function (TVF), written in C#, that splits a comma-separated string into a table with one column. It also contains an aggregate function that converts a string column to a comma-separated string.

SQL/CLR

In-Process Data Access Sample

This sample contains a number of simple functions demonstrating various features of the SQL CLR in-process data access provider.

SQL/CLR

User-Defined Type Sample

This sample shows the creation and use of a simple user-defined data type (UDT) from both Transact-SQL and a client application using System.Data.SqlClient.

SQL/CLR

User-Defined Type Utility Sample

This sample contains a number of utility functions.  They include: functions to expose assembly metadata to Transact-SQL; sample streaming table valued functions (TVFs) to return the types in an assembly as a table, and also to return the fields, methods, and properties in a UDT. Technologies demonstrated: streaming table valued functions, reflection APIs, and invocation of TVFs from Transact-SQL.

Transact-SQL

AdventureWorks Scripts

Provides two alternatives to using the schemas in AdventureWorks. For more information, see Schemas in AdventureWorks in SQL Server Books Online.

Transact-SQL

Create DatabaseSnapshot

Creates a database snapshot of the AdventureWorks sample database.  Not supported in SQL Express.

Transact-SQL

Create FileGroups

Creates 2 new file groups for the AdventureWorks sample database.

Transact-SQL

Sliding Window Script

The purpose of this sample is to demonstrate the ability to move partitions between tables using the Transact-SQL ALTER TABLE SWITCH statement.

Transact-SQL

Table and Index Partitioning Script

Demonstrate table and index partitioning capabilities of SQL Server “Yukon.”

XML

On-line Manufacturing Instructions

Retrieves manufacturing instructions XML documents and XML illustration diagrams, and applies XSL transformation. The formatted HTML document is then shown in the browser.  This sample uses Create Endpoints which are not supported in SQL Express.

XML

On-line Product Catalog

Retrieves catalog description XML documents and product photo images, and applies XSL transformation. The formatted HTML document is shown in the browser.  This sample uses Create Endpoints which are not supported in SQL Express.

XML

On-line Store Survey

Conducts an on-line reseller survey and stores the survey in the Demographics column of the Store table.  This sample uses Create Endpoints which are not supported in SQL Express.