SSIS BIML generates SQL code with brackets

谁说我不能喝 提交于 2019-12-04 04:17:51

问题


Im using BIML to dynamically create load packages for SSIS to load data from Informix to SQL Server. The problem is that this BIML code produces the SQL below

<DirectInput>SELECT <#=table.GetColumnList()#> FROM <#=table.GetTag("SourceSchemaQualifiedName")#></DirectInput>

SELECT [column1], [column2], [column3], FROM [mySchema].[mySrcTable]

But that doesnt work in my source database because of the brackets. Any way i can get the columnlist & tablename without the brackets dynamically?


回答1:


You should be able to use the overloaded method of GetColumnList

<#=table.GetColumnList(string.Empty, "\"", "\"")#>

which should produce a double quote wrapped column name with no table alias - which I think is what Informix expects.




回答2:


This works for both column names and table name:

                        <OdbcSource Name="Data from informix" Connection="Source_Informix">
                            <DirectInput>SELECT <#=table.GetColumnList(string.Empty, "", "")#> FROM schema.<#=table.Name#></DirectInput>
                        </OdbcSource>
                        <OleDbDestination Name="Data to MSSQL" ConnectionName="Target_MSSQL">
                            <TableOutput TableName="<#=table.ScopedName#>"/>
                        </OleDbDestination>


来源:https://stackoverflow.com/questions/48770240/ssis-biml-generates-sql-code-with-brackets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!