OLE DB Source component is primarily fetching data from DB, passing it to downstream components, and the strength of OLE DB Source component is that query data has four mode,
Table or view: Pass directly to table or view
Table name or view name variable: The name of a table or view is stored in a variable of the package
SQL command: Enter the SQL command, and you can use the parameters in the SQL command in the parameters. Represent
SQL command from variable: Save SQL command in one variable of the package
In these four Data Access Mode, each has its own purpose:
1,table or view
The simplest way to get the entire table or view data directly, but you can select only a subset of the columns in columns, which reduces the amount of data passed to downstream components, and four data Access modes can partially pass the columns.
2,table name or view name from variable
This mode, which stores the table name or view name in the variable of the package, can dynamically change the value of variable in the package, but the vision is fine, but because DataSource Determines the structure of the columns, so, dynamically change the value of variable in the package, from the different datasource query data, you must ensure that the structure of the columns is the same, otherwise, the "fail in running
3,sql command
This mode has great flexibility and applicability because SQL command mode can use parameter, which is an exciting design.
Parameters are specified by parameters, and parameters passed to SQL command can be stored in a package variable, dynamically modifying the value of the package variable in the package to query different data.
Example: Parameters do not use @variablename, but use one? , which is the special point of OLE DB source, each one? All represent a parameter, because? The order in which SQL command appears is fixed, so you can navigate to each parameter by ordinal 0,1,2 (ordinal starting from 0).
The map parameter in parameters? Serial number and package variable, which in turn will pass the value of the package variable to SQL command.
4,sql command from variable
This mode is to store SQL command in the package variable and cannot use parameter
OLE DB Source component simple application