Tutorial Gateway

  • C
  • C#
  • Python
  • SQL
  • Java
  • JS
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs
  • MySQL

SSIS Data Conversion

SSIS Data Conversion Transformation is similar to T-SQL function CAST or CONVERT. If you wish to convert the data from one data type to another data type, then SSIS Data Conversion is the best bet. But, please make sure that you have compatible data in the column, and don’t forget to change the column length for Varchar, NVarchar data types.

Here, we will Export data present in the DimProducts Excel Worksheet to the SQL Server database table by converting the data type from DT_NTEXT to DT_WSTR using SSIS Data Conversion. The below image shows the data present in the DimProducts Excel file.

SSIS Data Conversion 0

SSIS Data Conversion Transformation Example

STEP 1: Drag and drop the data flow task from the toolbox to control flow and rename it as SSIS Data Conversion Transformation

SSIS Data Conversion 1

Double click on it, and it will open the data flow tab. Next, drag and drop EXCEL Source, SSIS Data Conversion Transformation from the toolbox to the data flow region.

SSIS Data Conversion 2

STEP 3: Double click on Excel source in the data flow region will open the connection manager settings. And it provides an option to select the table holding the source data.

SSIS Data Conversion 3

From the above screenshot, you can observe that we are selecting the DimProducts.xls file present in our local hard drive

SSIS Data Conversion 4

From the above image, you can see we are choosing the Product Destination table present in the DimProducts.xls. Click on the columns tab to verify the columns. In this tab, we can uncheck the unwanted columns also.

SSIS Data Conversion 5

Click ok and drag the blue arrow from Excel Source to SSIS Data Conversion Transformation. It will allow the transformation to use the source data.

STEP 5: Double click or right-click on the SSIS Data Conversion Transformation to edit and convert our source columns data type to required data type with length.

SSIS Data Conversion 6

It is the table description we are using for the destination table

-- SSIS Data Conversion Example
USE [SSIS Tutorials]
GO

CREATE TABLE [dbo].[DimProduct]
( 
 [ProductKey] [int] IDENTITY(1,1) NOT NULL, 
 [EnglishProductName] [nvarchar](50) NOT NULL, 
 [Color] [nvarchar](50) NOT NULL, 
 [ListPrice] [money] NULL, 
 [DealerPrice] [money] NULL, 
 [EnglishDescription] [nvarchar](400) NULL, 
 [SalesAmount] [money] NOT NULL, 

 CONSTRAINT [PK_DimProduct_ProductKey] PRIMARY KEY CLUSTERED 
 ( 
  [ProductKey] ASC 
 ) 
) 
GO 

We have to change our data types before we transfer data to the SQL server destination table to match Excel columns with the destination table.

NOTE: It is always necessary to convert data types during the transfer from Excel to the SQL server database.

STEP 6: Change the data type from DT_NTEXT to DT_WSTR, and don’t forget to change the length.

SSIS Data Conversion 7

Most of the time, intelligence automatically changes the data type. However, sometimes we have to do it on our own. Click ok

STEP 7: Now, we have to provide the Server, database, and table details of the destination. So double-click on the OLE DB Destination and provide the required information

SSIS Data Conversion 8

STEP 8: Click on the SSIS Mappings tab to check whether the source columns mapped precisely to the destination columns.

SSIS Data Conversion 9

If you forget the conversion, it will fail because of the data conversion from DT_NTEXT to DT_WSTR. Let’s map the correct columns and Click ok to finish our SSIS Data Conversion package design. Let us run the package

SSIS Data Conversion 10

Check the results of SSIS Data Conversion Transformation

SSIS Data Conversion 11

Filed Under: SSIS

  • What is SSIS
  • Install SQL Server Data Tools
  • Learn SSIS in 28 Days
  • Create a SSIS Project
  • Create SSIS Package
  • SSIS Connection Manager
  • OLE DB Connection Manager
  • SSIS ADO Connection Manager
  • ADO.NET Connection Manager
  • SSIS Cache Connection Manager
  • SSIS Excel Connection Manager
  • SSIS File Connection Manager
  • SSIS FTP Connection Manager
  • SSIS SMO Connection Manager
  • Source Assistance in SSIS
  • Flat File Source in SSIS
  • OLE DB Source in SSIS
  • Excel Source in SSIS
  • ADO.NET Source in SSIS
  • SSIS FLAT FILE Destination
  • SSIS OLE DB Destination
  • SSIS ADO.NET Destination
  • SSIS Transformations
  • SSIS Audit Transformation
  • SSIS Aggregate Transformation
  • SSIS Aggregate Advanced Mode
  • SSIS Cache Transformation
  • SSIS Character Map
  • SSIS Conditional Split
  • SSIS Copy Column
  • SSIS Data Conversion
  • SSIS Derived Column
  • SSIS Export Column
  • SSIS Fuzzy Grouping
  • SSIS Fuzzy Lookup
  • SSIS Import Column
  • SSIS Lookup Introduction
  • Lookup – OLE DB Connection
  • SSIS Lookup in Full Cache Mode
  • SSIS Lookup – Case Sensitivity
  • SSIS Merge Transformation
  • SSIS Merge Join Transformation
  • SSIS Merge Join – Left Outer Join
  • SSIS Merge – Right Outer Join
  • SSIS Merge Join – Full Outer Join
  • SSIS Multicast Transformation
  • SSIS OLEDB Command
  • OLEDB Command – Delete Data
  • OLEDB Command-Update Data
  • SSIS Percentage Sampling
  • SSIS Pivot Transformation 2008
  • SSIS Pivot Transformation
  • SSIS Row Count Transformation
  • SSIS Row Sampling
  • Script Component as Source
  • Script Component as Destination
  • SSIS Script as Transformation
  • SSIS Sort Transformation
  • SSIS SCD Type 0
  • SSIS SCD Type 1
  • SSIS SCD Type 2
  • SSIS Term Lookup
  • SSIS Term Extraction Intro
  • Term Extraction – Extract Nouns
  • SSIS Extract Noun Phrases
  • Extract Nouns & Noun Phrases
  • Term Extraction – Exclusion Tab
  • SSIS Unpivot Transformation
  • SSIS Union All Transformation
  • SSIS For Loop Container
  • SSIS ForEach File Enumerator
  • SSIS ForEach SMO Enumerator
  • SSIS ForEach Variable
  • SSIS Foreach NodeList
  • Foreach ADO.NET Schema Rowset Enumerator
  • SSIS Bulk Insert Task
  • SSIS Data Profiling Task
  • Execute T-SQL Statement Task
  • SSIS Execute SQL Task Intro
  • SSIS Execute SQL Task Example
  • Execute SQL Task- Single Rowset
  • Execute SQL Task – Full Row Set
  • SSIS Execute Package Task
  • Execute Packages in SQL Server
  • Execute Packages in File System
  • SSIS Execute Package Project Reference
  • SSIS File System Task
  • SSIS File System Task- Copy Files
  • File System Task-Copy Directory
  • File System Task – Delete Files
  • File System Task – Delete Folder
  • File System Task -Move Directory
  • SSIS File System Task -Move File
  • File System – Move Multiple files
  • File System Task – Rename File
  • File System Task – Set Attributes
  • SSIS FTP TASK
  • SSIS Create Local Directory
  • SSIS Create Remote Directory
  • SSIS FTP Task Send Files
  • SSIS FTP – Send Multiple Files
  • SSIS FTP Task Delete Local Files
  • FTP TASK Delete Local Directory
  • FTP Task Delete Remote files
  • SSIS Delete Remote Directory
  • SSIS FTP Task Receive Files
  • SSIS FTP Receive Multiple Files
  • SSIS Script Task
  • Transfer SQL Server Objects Task
  • Transfer SQL Table Structures
  • Transfer SQL Tables with Data
  • Transfer SQL Stored Procedures
  • Transfer User Defined Functions
  • Transfer SQL Views in SSIS
  • SSIS Web Service Task
  • SSIS XML Task-Validate XML File
  • Transform XML File using XSLT
  • XML Task-XML files Differences
  • Create SSIS Catalog
  • Package Deployment using BIDS
  • Deploy Package Using SQL
  • Deploy using SQL Server Wizard
  • SSIS Breakpoints
  • SSIS Checkpoints
  • SSIS Error Handling
  • SSIS Event Handlers
  • SSIS Transactions
  • SSIS Logging
  • SSIS Parameters
  • SSIS Package Configuration
  • Configure using SQL Server
  • Config using Registry Entry
  • Conf with Environment Variable
  • SSIS XML Configuration File
  • XML Configuration File Part 2
  • SSIS Package Protection Level
  • SSIS Incremental Load
  • Incremental Load Example 2
  • SSIS Remove Double Quotes

Copyright © 2021· All Rights Reserved by Suresh.
About | Contact | Privacy Policy