Sunteți pe pagina 1din 20

Tutorial: Creating a Basic Package Using a Wizard

Microsoft Integration Services provides the SQL Server Import and Export Wizard for building packages that perform data transfers. These packages can extract data from a source and load it into a destination, but the package can perform only minimal data transformation in the transfer process. In addition, the wizard is a quick way to create basic packages that can then be enhanced in SSIS Designer. In this tutorial, you will learn how to use the SQL Server Import and Export Wizard to create a basic package. The package that you create extracts data from an Excel workbook and loads it into a table in the AdventureWorks2008R2 database. The table is defined as one of the steps in the wizard and then created dynamically when you run the package. In subsequent lessons, the package will be expanded to include a data flow that sorts the data, creates a new column, and populates the column with values. To generate the new values, you will learn how to use the new Integration Services expression language together with the graphical expression builder to write an expression that creates new values based on existing data columns. When you install the sample data that the tutorial uses, you also install the completed versions of the packages for each lesson of the tutorial. By using the completed lesson 1 package, you can skip ahead and begin the tutorial with lesson 2 if you like. If this is your first time working with packages, the SQL Server Import and Export Wizard, or the new development environment, we recommend that you begin with lesson 1.

What You Will Learn


The best way to become acquainted with the new tools, controls, and features available in Microsoft SQL Server Integration Services is to use them. This tutorial first walks you through the SQL Server Import and Export Wizard to create a basic data-transfer package, and then shows you how to enhance the data transformation capabilities of the package by using SSIS Designer.

Requirements
This tutorial is intended for users familiar with fundamental database operations, but who have limited exposure to the new features available in SQL Server Integration Services. To use this tutorial, your system must meet the following requirements: You must run the package that this tutorial creates in 32-bit mode. This sample uses the Microsoft Jet 4.0 OLE DB provider, for which there is no 64-bit version. The package fails if you run it in 64-bit mode. For more information about running packages in 32-bit mode on a 64-bit computer, see 64 bit Considerations for Integration Services.

SQL Server with the AdventureWorks2008R2 database must be installed on the computer. To enhance security, the sample databases are not installed by default. To install the sample databases, see Considerations for Installing SQL Server Samples and Sample Databases. You must have permission to create and drop tables in AdventureWorks2008R2. The sample data must be installed on the computer. The sample data is installed together with the samples. If you cannot find the sample data, return to the procedure above and complete installation as described.

Note

When reviewing tutorials it is recommended you add Next and Previous buttons to the document viewer toolbar and Previous Buttons to Help.
This tutorial assumes that you have not reconfigured SSIS Designer to use auto-connect features between control flow elements or between data flow elements. If SSIS Designer uses auto-connect, an element may be connected automatically when added to the design surface. Also, the auto-connect feature for control flow supports the use of Failureand Completion as the default constraint, instead of Success. If SSIS Designer is not using Success as its default constraint, you should reset this configuration while doing the tutorial. You configure the auto-connect features in the Business Intelligence Designers section in the Options dialog box that is available from Options on the Tool menu. Estimated time to complete this tutorial: 1 hour

Lessons in This Tutorial


Lesson 1: Creating the Basic Package In this lesson, you will use the SQL Server Import and Export Wizard to create a data-transfer package. Lesson 2: Enhancing the Basic Package In this lesson, you will enhance the basic package to include a sort operation, and to add a new column and column values to the existing dataset.

Lesson 1: Creating the Basic Package


SQL Server 2008 R2 Other Versions

In this lesson, you will create a basic package by using the SQL Server Import and Export Wizard. The package selects and extracts data from an Excel spreadsheet and writes that data to the ProspectiveCustomers table in the AdventureWorks2008R2 sample database. The table is defined in the wizard and created when you run the package. The SQL Server Import and Export Wizard will be run in Business Intelligence Development Studio and you will launch the wizard from an Integration Services project. After you complete the SQL Server Import and Export Wizard the package is added to the Integration Services project. You will open the package in SSIS Designer, the Integration Services graphical tool for building complex packages, and verify that certain properties of the package are configured correctly. Finally, you will test the package by running it in Business Intelligence Development Studio.

Important

This tutorial requires the AdventureWorks2008R2 sample database. For more information on installing and depl see Considerations for Installing SQL Server Samples and Sample Databases.

Lesson Tasks
This lesson contains the following tasks: Step 1: Creating the Integration Services Project Step 2: Running the Wizard to Create the Basic Package Step 3: Testing the Lesson 1 Basic Package

Step 1: Creating the Integration Services Project


SQL Server 2008 R2 Other Versions

This tutorial uses the SQL Server Import and Export Wizard to create a basic package by running the wizard in Business Intelligence Development Studio. The wizard is launched from an Integration Services project. In this task you will create an Integration Services project.

To create the Integration Services project


1. 2. 3. 4. 5. 6. 7. 8. On the Start menu, point to All Programs, point to Microsoft SQL Server, and click SQL Server Business Intelligence Development Studio. On the File menu, point to New, and click Project to create a new Integration Services project. In the New Project dialog box, select Integration Services Project in the Templates pane. In the Name box, change the default name to SQL Server Import and Export Wizard Tutorial. Optionally, clear the Create directory for solution check box. Accept the default location, or click Browse to browse to locate the folder you want to use. In the Project Location dialog box, click the folder and click Open. Click OK. By default, an empty package, named Package.dtsx, is created and added to every new project. However, you will not use this package because the wizard will create its own package. You can delete Package.dtsx, or use it as the basis for a different package later. To delete it, right-click it and then click Delete.

Step 2: Running the Wizard to Create the Basic Package


SQL Server 2008 R2 Other Versions

In this task, you will run the SQL Server Import and Export Wizard to create the basic data transfer package. Specify the data source. You will use the Excel workbook, Customers.xls, as the data source. On a wizard page you will provide a query that selects the customers who own at least one car from the Customers spreadsheet in the workbook.

Specify the destination. You will write the data to a table in the AdventureWorks2008R2 database. The table, ProspectiveCustomers, will be created dynamically. You will define the metadata of the destination columns by using the wizard.

After the wizard completes, you will rename the package and verify the values of certain locale-sensitive properties of the package, tasks, source, and destination. This step is important because the Excel workbook includes locale-sensitive date data in the BirthDate column. If the regional settings on your computer do not specify English (United States), you must update the values of the specified properties or the package cannot be run successfully.

To run the SQL Server Import and Export Wizard


1. 2. 3. 4. If it is not already open, open the Integration Services project that you created in the previous task. In Solution Explorer, right-click the SSIS Packages folder and click SSIS Import and Export Wizard. If the Solution Explorer window is not open, click Solution Explorer on the View menu. On the Welcome page of the SQL Server Import and Export Wizard, click Next. On the Choose a Data Source page, do the following steps: a. In the Data source list, select Microsoft Excel. b. Click Browse, navigate to C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Tutorial\Creating a Basic Package\Sample Data, click the Excel workbook file, Customers.xls, and then click Open. c. Verify that the Excel file path box contains "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Tutorial\Creating a Basic Package\Sample Data\Customers.xls". d. Verify that the Excel version box contains Microsoft Excel 97-2003 and the First Row has column names check box is selected. On the Choose Destination page, do the following steps: a. In the Destination list, Select SQL Server Native Client, and in the Server name box, type localhost. When you specify localhost as the server name, the connection manager connects to the default instance of SQL Server on the local computer. To use a remote default instance or a named instance of SQL Server, replace localhost with the name of the server or server and named instance to which you want to connect. To connect to a named instance use the format <server name>\<instance name>. b. If the instance of the Database Engine that you specified supports Windows Authentication, use the default Windows Authentication mode; otherwise, click Use SQL Server Authentication and type a user name in the User name box and a password in the Password box. c. In the Database list, select AdventureWorks2008R2. 6. On the Specify Table Copy or Query page, click Write a query to specify the data to transfer. 7. On the Provide a Source Query page, in the SQL statement box, type or copy the following SQL statement: 8. SELECT * FROM [Customers$] WHERE NumberCarsOwned > 0 9. On the Select Source Tables and Views page, do the following steps:

5.

In the Destination list, click [dbo].[Query], and then change the table name, Query, to ProspectiveCustomers. b. To edit column metadata and table options, click Edit Mappings. 10. On the Columns Mappings page, do the following steps: a. Verify that the Create Destination table option is selected, select the Drop and recreate destination table check box, and modify the metadata of the destination columns. The following table lists the columns and the metadata changes that you need to make:

a.

Column name
FirstName MiddleIntial LastName BirthDate MaritalStatus Gender EmailAddress YearlyIncome TotalChildren NumberChildrenAtHome Education Occupation HouseOwnerFlag NumberCarsOwned AddressLine1 AddressLine2 City

Default type
nvarchar nvarchar nvarchar datetime nvarchar nvarchar nvarchar float float float nvarchar nvarchar float float nvarchar nvarchar nvarchar

Updated type
No change nchar No change No change nchar nchar No change money tinyint tinyint No change No change bit tinyint No change No change No change

State ZIP Phone

nvarchar float nvarchar

No change No change No change

b. Click OK. 11. On the Review Data Type Mapping page, accept the default settings and click Next. 12. On the Complete the Wizard page, review information about the new package and click Finish. 13. On the Performing Operations page, view the actions that the wizard performs. When finished, the Status column for each action should display Success. 14. Click Close. 15. In Solution Explorer, right-click the new package in the SSIS Packages folder, click Rename, and type Basic Package Lesson 1. Make sure that the name includes the .dtsx extension. 16. If asked whether to rename the object as well, click Yes.

To set locale sensitive properties of the package


1. 2. 3. Double click Basic Package Lesson 1.dtsx, click the Control Flow tab, and then click anywhere on the background of the design surface. On the View menu, click Properties Window. In the Properties window, verify that the LocaleID property is set to English (United States).

To set locale sensitive properties of the Execute SQL tasks


1. 2. 3. 4. On the Control Flow design surface, click Drop Table(s) SQL Task. On the View menu, click Properties Window. In the Properties window, verify that the Codepage property is set to 1252 and the LocaleID property is set to English (United States). Repeat steps 1-3 for Preparation SQL Task.

To set locale sensitive properties of the Data Flow task


1. 2. 3. Click Data Flow Task. On the View menu, click Properties Window. In the Properties window, verify that the LocaleID property is set to English (United States).

To set locale sensitive properties of data flow components


1. 2. 3. 4. 5. Double-click Data Flow Task or click the Data Flow tab. On the Data flow tab, click Source - Query. On the View menu, click Properties Window. In the Properties window, verify that the LocaleID property is set to English (United States). Repeat steps 2-4 for Destination - ProspectiveCustomers.

Step 3: Testing the Lesson 1 Basic Package


SQL Server 2008 R2 Other Versions

In this lesson, you have done the following tasks: Created a new Integration Services project. Run the SQL Server Import and Export Wizard to create the basic package. Verified and updated the values of locale sensitive properties.

Your package is now complete! It is time to test your package.

Important

The first time you run the package, the task named Drop table(s) SQL Task will fail. This behavior is expected. T attempts to drop and re-create the ProspectiveCustomers table; however, the first time that the package runs the t fails. This does not cause the package to fail because the precedence constraint between the Drop table(s) SQL T to Completion rather than Success.

Checking the Package Layout

Before you test the package you should verify that the control and data flows in the lesson 1 package, Basic Package Lesson 1.dtsx, contain the objects shown in the following diagrams. Control Flow

Data Flow

Also, the package should include the following two connection managers. One connects to the Excel workbook file Customers.xls and the other one connects to the AdventureWorks2008R2 database.

To run the Lesson 1 package


1. 2. In Solution Explorer, click Basic Package Lesson 1.dtsx. On the Debug menu, click Start Debugging. The package will run, resulting in 809 rows successfully added into the ProspectiveCustomers table in AdventureWorks2008R2. 3. After the package has completed running, on the Debug menu, click Stop Debugging.

Lesson 2: Enhancing the Basic Package


SQL Server 2008 R2 Other Versions

In Lesson 1: Creating the Basic Package, you used the SQL Server Import and Export Wizard to get a quick start on a basic Integration Services package. The package has limited functionality; it only extracts data from an Excel workbook file and loads the data into the ProspectiveCustomers table of the AdventureWorks2008R2 sample database. Typically, a package also needs to manipulate and transform the data. Integration Services provides a wealth of transformations that you can use to copy, cleanse, modify, sort, and aggregate data. If you need to transform data in ways that are not supported by the standard transformations, you can easily write a script for the Script transformation or code a custom transformation to address your needs. In this lesson you will enhance the basic package to sort the data and add a new column based on values from other columns to the dataset. In this scenario, one column contains null values, which present problems when concatenating values from existing columns. To work around this problem and generate the value for the new column, you will use a new Integration Services featureexpressions. The Integration Services expression language includes functions, operators, and type casts that you can use to build complex expressions. You will use an expression to concatenate the values from three columns and conditionally insert a space between columns, and then add the new value to the new column. Because a new column is added to the dataset, the ProspectiveCustomers table and the OLE DB destination must be modified to include this column. You will update both the SQL statement in the Execute SQL task that created the ProspectiveCustomers table, and the OLE DB destination that writes data to the table, to include this new column. You will also map the new column in the dataset to the new column in the table. In this lesson, you will copy and then enhance the basic created in Lesson 1. If you have not completed the previous lesson, you can also copy the completed package for Lesson 1 that is included with the tutorial.

Important

This tutorial requires the AdventureWorks2008R2 sample database. For more information about how to install a see Considerations for Installing SQL Server Samples and Sample Databases.

Lesson Tasks
This lesson contains the following tasks:

Step 1: Copying the Lesson 1 Basic Package Step 2: Updating the Execute SQL Task Step 3: Adding and Configuring the Sort Transformation Step 5: Modifying the OLE DB Destination Step 6: Testing the Lesson 2 Basic Package

Step 1: Copying the Lesson 1 Basic Package


SQL Server 2008 R2 Other Versions

In this task, you will create a copy of the package that you created in Lesson 1, named Basic Package Lesson 1.dtsx. If you did not complete Lesson 1, you can add the completed Lesson 1 package that is included with the tutorial to the project, and then copy it instead. You will use this new copy throughout the rest of Lesson 2.

To create the Lesson 2 package


1. If Business Intelligence Development Studio is not already open, click Start, point to All Programs, point to Microsoft SQL Server, and then click Business Intelligence Development Studio. On the File menu, click Open, click Project/Solution, click the SQL Server Import and Export Wizard Tutorial folder and click Open, and then double-click SQL Server Import and Export Wizard Tutorial.sln. In Solution Explorer, right-click Basic Package Lesson 1.dtsx, and then click Copy. In Solution Explorer, right-click SSIS Packages, and then click Paste. By default, the copied package will be named Basic Package Lesson2.dtsx. 5. 6. 7. 8. In Solution Explorer, double-click Basic Package Lesson 2.dtsx to open the package. Right-click anywhere in the background of the Control Flow design surface and click Properties. In the Properties window, update the Name property to Basic Package Lesson 2. Click the box for the ID property, and then in the list, click <Generate New ID>.

2.

3. 4.

To add the completed Lesson 1 package


1. 2. Open Business Intelligence Development Studio and open the SQL Server Import and Export Wizard Tutorial project. In Solution Explorer, right-click SSIS Packages, and click Add Existing Package.

3. 4.

5.

In the Add Copy of Existing Package dialog box, in Package location, select File system. Click the browse () button, navigate to C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Tutorial\Creating a Basic Package\Completed Packages, select Basic Package Lesson 1.dtsx, and then click Open. Copy and paste the Basic Package Lesson 1 package as described in steps 3-8 in the previous procedure.

Step 2: Updating the Execute SQL Task


SQL Server 2008 R2 Other Versions

In this task, you will update the SQL statement in the Execute SQL task named Preparation SQL Task. The existing SQL statement was automatically generated from the options you specified when you stepped through the SQL Server Import and Export Wizard pages to create the lesson 1 package. This SQL statement creates the Query table in the AdventureWorks2008R2 database when the package is run. Later in this lesson, you will generate an additional column to the data that is extracted from the Excel spreadsheet, and you need to include a definition of that column in the SQL statement.

To modify the SQL statement


1. 2. 3. 4. Click the Control Flow tab. Double-click Preparation SQL Task. On the General page, click the SQLStatement property, and then click the browse button (). In the Enter SQL Query dialog box, add a comma at the end of the line, [Phone] nvarchar (50), press Enter, and on the new line, type [FullName] nvarchar (103). The completed SQL statement should look like this: CREATE TABLE [AdventureWorks2008R2].[dbo].[Query] ( [FirstName] nvarchar(50), [MiddleInitial] nchar(1), [LastName] nvarchar(50), [BirthDate] datetime,

[MaritalStatus] nchar(1), [Gender] nchar(1) NOT NULL, [EmailAddress] nvarchar(50), [YearlyIncome] money, [TotalChildren] tinyint, [NumberChildrenAtHome] tinyint, [Education] nvarchar(50), [Occupation] nvarchar(50), [HouseOwnerFlag] bit, [NumberCarsOwned] tinyint, [AddressLine1] nvarchar(60), [AddressLine2] nvarchar(60), [City] nvarchar(30), [State] nchar(3), [ZIP] float, [Phone] nvarchar(50), [FullName] nvarchar (103) ) GO 5. 6. 7. Click OK. Click Parse Query. The SQL statement should parse successfully. Click OK.

Step 3: Adding and Configuring the Sort Transformation

SQL Server 2008 R2 Other Versions

In this task, you will add and configure a Sort transformation to your package. A Sort transformation is a data flow component that sorts data, and optionally applies rules to the comparison that the sort performs. The sort transformation can also be used to remove rows of data that have duplicate sort key values. The sort transformation will sort the data extracted from the Excel spreadsheet by state and by city.

To add a Sort transformation


1. 2. 3. Open the Data Flow designer, either by double-clicking Data Flow Task or by clicking the Data Flow tab. Right-click the path (the green arrow) between Data Conversion and Destination - Query and then click Delete. In the Toolbox, expand Data Flow Transformations, and then drag Sort onto the design surface of the Data Flow tab, below Data Conversion. If Destination - Query is in the way, click it and drag it to a position lower on the Data Flow design surface. On the Data Flow design surface, click Sort in the Sort transformation, and change the name to Sort by State and City. Click Source - Query and drag its green arrow to Sort by State and City. Double-click Sort by State and City to open the Sort Transformation Editor dialog box. In the Available Input Columns list, first select the check box to the left of the State column, and then the select the check box by the City column. The columns now appear in the Input Column list. State has the sort order 1 and City has the sort order 2. This means that the dataset is sorted first by state and then by city. 8. In the Input Column list, click the row that contains State. Click the Comparison Flags box, select the Ignore case check box, and then click OK. 9. Click OK. 10. Right-click Sort by State and City and then click Properties. 11. In the Properties window, verify that the LocaleID property is set to English (United States).

4. 5. 6. 7.

Step 4: Adding and Configuring the Derived Column Transformation

SQL Server 2008 R2 Other Versions

In this task, you will add a Derived Column transformation to your package. A Derived Column transformation is a data flow component that creates new data values by using values in a dataset, constants, and variables, or by applying functions. You will use this transformation to add a new column and then populate the column with the evaluation results of an expression. The user interface for the Derived Column transformation includes the expression builder. This graphical tool makes it easy to quickly write complex expressions using drag and drop operations, and provides templates for functions, type casts, and operators as well as the input columns and variables. In the Derived Column transformation, you will create an expression that concatenates the values in the FirstName, MiddleInitial, and LastName columns in the dataset and then writes the result to a new column. Because the middle initial may be null, the expression will include special handling of this column. The new column, FullName, will be added to the transformation output.

To add a Derived Column transformation


1. If not already open, open the Data Flow designer, either by double-clicking Data Flow Task or by clicking the Data Flow tab. 2. In the Toolbox, expand Data Flow Transformations, and then drag a Derived Column transformation onto the design surface of the Data Flow tab, below Sort by State and City. 3. On the Data Flow design surface, click Derived Column in the Derived Column transformation, and change the name to Add FullName Column. 4. Click Sort by State and City and drag its green arrow to Add FullName Column. 5. Double-click Add FullName Column to open the Derived Column Transformation Editor dialog box. 6. In the left pane, expand the Columns folder, click the FirstName column and drag it to the Expression box. 7. In the Expression box, after [FirstName], type + " " +. 8. In the Columns folder, click the MiddileInitial column and drag it to the Expression box. 9. Update [MiddleInitial] to (ISNULL(MiddleInitial) ? "" : MiddleInitial + " ") + . 10. In the Columns folder, click the LastName column and drag it to the Expression box. 11. Verify that the value in the Expression box is the following: FirstName + " " + (ISNULL([MiddleInitial]) ? "" : [MiddleInitial] + " ") + [LastName]

You may optionally remove the brackets that enclose column names in the expression. The column names are regular identifiers, which do not need to be enclosed in brackets. Names that contain invalid characters, such as spaces, must be enclosed in brackets. If the expression has been typed incorrectly, the expression text will appear in red. 12. In the Derived Column box for the row you just created, select <add as new column>. 13. In the Derived Column Name box for the same row, type FullName. 14. If the Data Type box is not already set to Unicode string [DT_WSTR], select Unicode string [DT_WSTR] in the Data Type list. 15. Set the value of the Length box to 103 (the sum of the lengths of the FirstName, MiddleInitial, LastName columns, and two spaces.) 16. Click OK. 17. In the Properties window, verify that the LocaleID property is set to English (United States).

Step 5: Modifying the OLE DB Destination


SQL Server 2008 R2 Other Versions

Earlier in lesson 2, you updated the SQL statement in the Execute SQL task, Preparation SQL Task, to include a definition of the FullName column in the Query table. In this task, you will modify the OLE DB destination, Destination - Query, to support the FullName column. You will also restore the column mappings in Destination - Query that are no longer valid because you added a Sort transformation to the data flow. The Sort transformation generates a new set of columns with different column identifiers, and you therefore need to remap the input columns and destination columns in Destination - Query.

To modify the OLE DB destination


1. If not already open, open the Data Flow designer, either by double-clicking Data Flow Task or by clicking the Data Flow tab. 2. Click the Derived Column transformation named Add FullName Column anddrag its green arrow to Destination - Query. 3. Double-click Destination - Query. 4. In the Restore Invalid Column Reference Editor dialog box, click Select All, select the <Map using column name> option in the Column mapping option for selected rows list, and then click Apply.

You can clear the Include downstream invalid column references check box. In this package, there are no downstream data flow components and this option has no effect. 5. Click OK. 6. Right-click Destination - Query and click Show Advanced Editor. 7. In the Advanced Editor dialog box, click the Input and Output Properties tab, expand Destination Input, click External Columns, and then click Add Column. A new column named Column is added to the External Columns folder. 8. Click the new column. 9. In the right-hand pane, update the Name property to FullName, click the DataType property and select Unicode string [DT_WSTR] from the list. Update the Lengthproperty to 103. 10. Click the Columns Mappings tab, and scroll down to the row with FullName in the Destination Column list. Click <ignore> in the Input Column list of that row, and then click FullName in the list. 11. Verify that all input and output columns that have the same names are mapped. 12. Click OK.

Step 6: Testing the Lesson 2 Basic Package


SQL Server 2008 R2 Other Versions

In this lesson, you have done the following tasks: Updated the SQL statement in the Execute SQL task to include a definition for an additional column. Added and configured a Sort transformation to sort the dataset by state and then by city. Added a Derived Column transformation and configured it to use an expression to generate values for a new column. Modified the OLE DB destination to write the new column, FullName, to the ProspectiveCustomers table.

Your package is now complete! It is time to test your package.

Important

The first time you run the package, the Drop table(s) Task will fail. This behavior is expected. The reason this ha and re-create the ProspectiveCustomers table; however, the first time that the package runs the table does not exi

Checking the Package Layout

Before you test the package, you should verify that the control and data flows in the Lesson 1 package contain the objects shown in the following diagrams. Control Flow

Data Flow

Also, the package should include the following two connection managers. One connects to the customers.xls Excel workbook file and the other one connects to the AdventureWorks2008R2 database.

To run the Lesson 2 package


1. 2. In Solution Explorer, click Basic Package Lesson 2.dtsx. On the Debug menu, click Start Debugging. The package will run, resulting in 809 rows successfully added into the Query table in the AdventureWorks2008R2 database. 3. After the package has completed running, on the Debug menu, click Stop Debugging.

To verify the contents of the ProspectiveCustomers table


1. 2. On the Start menu, point to All Programs, point to Microsoft SQL Server, and click SQL Server Management Studio. In the Connect to Server dialog, select Database Engine in the Server type list, provide the name of the server on which the AdventureWorks2008R2 database is installed in the Server name box, and select an authentication mode option. If you select SQL Server Authentication, provide a user name and a password. Click Connect. SQL Server Management Studio opens. On the toolbar, click New Query. Type or copy the following query in the query window.

3. 4. 5.

SELECT * FROM AdventureWorks2008R2.dbo.ProspectiveCustomers 6. On the toolbar, click Execute. The Results pane shows the dataset, including the new FullName column. You can verify that your expression formatted the column value correctly depending on whether the middle initial is null.

S-ar putea să vă placă și