Parameterized OLEDB source query

后端 未结 3 1145
情话喂你
情话喂你 2020-11-27 20:14

I am creating an ETL in SSIS in which I which I want my data source to be a restricted query, like select * from table_name where id=\'Variable\'. This variable

3条回答
  •  无人及你
    2020-11-27 20:46

    When using OLEDB Connection manager (with SQL Server Native Client 11.0 provider in my case) you can catch an error like this:

    Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the command. In that case, use the "SQL command from variable" access mode, in which the entire SQL command is stored in a variable.

    So you need to explicitly specify database name in OLEDB Connection manager properties. Otherwise SQL Server Native Client can use different database name then you mean (e.g. master in MSSQL Server). For some cases you can explicitly specify database name for each database object used in query, e.g.:

    select Name
    from MyDatabase.MySchema.MyTable
    where id = ?
    

提交回复
热议问题