简体   繁体   English

在SSIS中的Attunity上运行SQL脚本

[英]Run SQL script on Attunity in SSIS

Currently I am running a script in sqldeveloper to get my data from oracle and dump into CSV file and then I import CSV file into SQL Server. 目前,我正在sqldeveloper中运行脚本,以从oracle获取数据并将其转储到CSV文件中,然后将CSV文件导入SQL Server。 Now, I have VS 2017 and I am trying to get same data into SQL server from Oracle database through Attunity driver. 现在,我有了VS 2017,我正在尝试通过Attunity驱动程序将相同的数据从Oracle数据库导入SQL Server。

I could connect oracle database using Oracle Source in data flow but at this point I am stuck, I don't know how to run my existing script which has multiple multiple SQL commands - in first line I alter my session to point to correct schema followed by setting some variables, environment setting and select statements. 我可以使用Oracle Source在数据流中连接oracle数据库,但是到现在为止,我仍然处于卡住状态,我不知道如何运行具有多个SQL命令的现有脚本-在第一行中,我更改了会话以指向正确的架构通过设置一些变量,环境设置和选择语句。

Since you didn't provided the SQL command, i will give you some insights: 由于您未提供SQL命令,因此我将为您提供一些见解:

In the Oracle Attunity Source if you select the SQL Command access mode, you can write any complex SQL Command even if it contains multiple commands but you must be aware that the first select statement that return a result set (not used to set a variable value) will be considered as source . 在Oracle Attunity Source中,如果选择SQL Command访问模式,则可以编写任何复杂的SQL Command,即使它包含多个命令,也必须注意, 第一个select语句返回结果集(不用于设置变量值) )将被视为来源

Possible workaround 可能的解决方法

If there you are generating data from multiple select statement try using UNION ALL , so all select statement are considered as one command. 如果您要从多个select语句生成数据,请尝试使用UNION ALL ,因此将所有select语句视为一条命令。 Or, try inserting all data into a temp table then select data from these table at the end of the whole SQL command. 或者,尝试将所有数据插入到临时表中,然后在整个SQL命令的末尾从这些表中选择数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM