Csv to SQL Server: How to transfer data from Csv to SQL Server
Step
1. Create a new job, and open the [Design Job] interface.
2. Create a new Text dataset as target in [Design Job] interface, and open the property dialog of Text dataset, set parameters of Csv file in [Format] sheet, then click [Import field definition] button in [Fields] sheet to import field definition information.
Following is the detailed parameters of Text dataset should be setted.
Property name
Description
File name
File name. The file should be stored in ASIIC format.
Allow getting batch text file with pattern file ,for example:.
File Name: c:\temp\*.csv..
If the file name is above, Text dataset will get all the file which¡¯s extension is ¡°.csv¡±..
Or an use the pattern character ¡°?¡± to get the specify file, for example: If the file name is c:\temp\a?.csv, text dataset will get all the csv file which first character is ¡°a¡± and the file name only have 2 character.
Field
List the definition information of the field that has the above format.
Before reading source data, you must define field¡¯s information. About how to get field information.
3. Create a new MSSQL dataset as target in [Design Job] interface, and open the property dialog of MSSQL dataset, set SQL Server connection parameters in [Database] sheet, then click [Import field definition] button in [Fields] sheet to import field definition information.
Following is the detailed parameters of SQL Server should be setted.
Property name
Description
Host
The host name or DNS name of SQL Server server.
Database
Database name of SQL Server server.
User name
It is used to connect the SQL Server database.
Password
Connecting password of the SQL Server database.
Table name
Once you set up the parameters for database connection, click the combo box, all tables will be listed.
Create New table
Create a new table in target database. If it already exits, the new table can't be created
Submit records
Generally, capability is better when parameter is set as 100.
Field
List the definition information of the field that has the above format.
Before reading source data, you must define field¡¯s information. About how to get field information.
4. Connect source and target. Create a new DBLink between Text dataset and MSSQL dataset, and open the property dialog of DBLink, then set the "update mode" parameter.
5. Mapping fields. Click [Field mapping] button in [General] sheet in property dialog of DBLink to open [Set DBLink Fields Mapping] interface. You can edit calculation expression for each target fields, or drop source field to target field by mouse to generate field mapping list.