SMOTableList Sample



[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
This sample works only with SQL Server 2005 and SQL Server "Katmai". It will not work with any version of SQL Server earlier than SQL Server 2005.
The SmoTableList sample illustrates how to enumerate the user tables in the AdventureWorks database. A Script task retrieves the schema and table names and puts them into two variables. Next, a Transact-SQL task executes a DBCC CHECKCONSTRAINTS command using the two variables.
This sample is not supported on Itanium-based operating systems.
For more information, see the topic, "Foreach Loop Container", in SQL Server Books Online.

Important:
Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples.



Running the Sample

If you already know how to locate, build, and install code samples, you can go directly to the section Testing the Sample, and read about how to configure and run the code sample.

Prerequisites

Running this sample package requires the following:

*

.NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. See the Books Online topic, Installing the .NET Framework SDK.
  • Microsoft SQL Server Integration Services
  • The sample package and data files that it uses must be installed on the local hard disk drive.
  • You must have attached and have administrative permissions on the AdventureWorks OLTP database. For more information about how to install samples, see the topic, "Installing Sample Integration Services Packages", in SQL Server Books Online.

Location

If the code sample was installed to the default location, the sample is located in the following directory:
C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Programming Samples\Control Flow\SmoTableList\CS\smotablelist
The C# solution for the code sample is located in the CS directory, and the Visual Basic solution is located in the VB directory.
For information about the two-step process required to install the samples, see Installing Samples.

Building the Sample

If you have not already generated a strong name key file, use the following procedure to generate this key file.

To generate a strong name key file

  1. To 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 -To 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.
  2. At the command prompt, use the change directory (CD) command to change the current folder of the command prompt window to the Samples folder. The key file that you create in this folder will be used by all SQL Server code samples. Note: To determine the folder where samples are located, click Start, point to All Programs, point to Microsoft SQL Server "Katmai", point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <drive>:\Program Files\Microsoft SQL Server\100\Samples.
  3. At the command prompt, run the following command to generate the key file:sn -k SampleKey.snk *Important:
For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.*

To build the sample

  1. Open Microsoft Visual Studio 2005.
  2. From the File | Open menu, click Project and open the solution (.sln) for the desired sample, which is SMOTableList.sln from the CS folder or from the VB folders, depending on the language you want.
  3. Click Build / Build SmoTableList on the menu. Testing the SampleThe package that the sample creates is saved to the following location: C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Programming Samples\Control Flow\SmoTableList\<language>\SmoTablelist\bin\debug\ SmoTableSamplePackage.dtsxTo view the package in the designer, create a new Integration Services project and add the existing .dtsx item to the project. For more information, see the topic, "How to: Add an Item to an Integration Services Project", in SQL Server Books Online. © 2007 Microsoft Corporation. All rights reserved.

Last edited Mar 6, 2007 at 9:11 PM by bonniefe, version 1

Comments

No comments yet.