如何更改 SSIS 中的标识符引号字符以连接到 ODBC DSN

发布于 2024-08-30 03:51:25 字数 1335 浏览 4 评论 0原文

我正在尝试创建一个 SSIS 2008 数据源视图,该视图通过 Ingres 的 ODBC 驱动程序从 Ingres 数据库读取。我已经下载了 Ingres 10 Community Edition 以获取 ODBC 驱动程序,安装它,在运行 SSIS 的服务器上设置数据访问服务器和 DSN。

如果我连接到运行 SSIS 的服务器上的 SQL Server 2008 数据库引擎,我可以通过运行以下命令通过 ODBC DSN 从 Ingres 检索数据:

SELECT *
FROM OPENROWSET( 'MSDASQL'
               , 'DSN=IngresODBC;UID=testuser;PWD=testpass'
               , 'SELECT * FROM iitables')

因此我非常确定 ODBC 设置是正确的。

如果我尝试使用 SQL Server 样式括号标识符引号进行相同的查询,则会收到错误,因为 Ingres 不支持此语法。

SELECT *
FROM OPENROWSET( 'MSDASQL'
               , 'DSN=IngresODBC;UID=testuser;PWD=testpass'
               , 'SELECT * FROM [iitables]')

错误为“[Ingres][Ingres 10.0 ODBC 驱动程序][Ingres 10.0]第 1 行,意外字符“[”。”。

我发现,当我尝试将 Ingres 中的表添加到 SSIS 数据源视图时,出现了相同的错误。选择 ODBC 提供程序的初始步骤运行良好,并且显示了要添加的表/视图的列表。然后,我选择任何表,并尝试将其添加到视图中,并收到“错误 [5000A] [Ingres][Ingres 10.0 ODBC 驱动程序][Ingres 10.0]第 3 行,意外字符 '['。”。

遵循埃德·哈珀(Ed Harper)创建命名查询的建议似乎也受到了阻碍。如果我在命名查询中输入以下文本:

SELECT *
FROM "iitables"

我仍然收到错误:“错误 [5000A] [Ingres][Ingres 10.0 ODBC 驱动程序][Ingres 10.0]第 2 行,意外字符 '['”。

根据该错误,SSIS 传递给 ODBC 的查询文本是:

SELECT [iitables].*
FROM 
(
SELECT *
FROM "iitables"
)
 AS [iitables]

看来 SSIS 假定括号引号字符是可接受的,但实际上不可接受。我怎样才能说服它不要使用它们?双引号是可以接受的。

I'm trying to create an SSIS 2008 Data Source View that reads from an Ingres database via the ODBC driver for Ingres. I've downloaded the Ingres 10 Community Edition to get the ODBC driver, installed it, set up the data access server and a DSN on the server running SSIS.

If I connect to the SQL Server 2008 Database Engine on the server running SSIS, I can retrieve data from Ingres over the ODBC DSN by running the following command:

SELECT *
FROM OPENROWSET( 'MSDASQL'
               , 'DSN=IngresODBC;UID=testuser;PWD=testpass'
               , 'SELECT * FROM iitables')

So I am quite sure that the ODBC setup is correct.

If I try the same query with SQL Server style bracketed identifier quotes, I get an error, as Ingres doesn't support this syntax.

SELECT *
FROM OPENROWSET( 'MSDASQL'
               , 'DSN=IngresODBC;UID=testuser;PWD=testpass'
               , 'SELECT * FROM [iitables]')

The error is "[Ingres][Ingres 10.0 ODBC Driver][Ingres 10.0]line 1, Unexpected character '['.".

What I am finding is that I get the same error when I try to add tables from Ingres to an SSIS Data Source View. The initial step of selecting the ODBC Provider works fine, and I am shown a list of tables / views to add. I then select any table, and try to add it to the view, and get "ERROR [5000A] [Ingres][Ingres 10.0 ODBC Driver][Ingres 10.0]line 3, Unexpected character '['.".

Following Ed Harper's suggestion of creating a named query also seems to be stymied. If I put into my named query the following text:

SELECT *
FROM "iitables"

I still get an error: "ERROR [5000A] [Ingres][Ingres 10.0 ODBC Driver][Ingres 10.0]line 2, Unexpected character '['".

According to the error, the query text passed by SSIS to ODBC was:

SELECT [iitables].*
FROM 
(
SELECT *
FROM "iitables"
)
 AS [iitables]

It seems that SSIS assumes that bracket quote characters are acceptable, when they aren't. How can I persuade it not to use them? Double quotes are acceptable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

染墨丶若流云 2024-09-06 03:51:25

我不知道如何更改引用的标识符,但您可以通过创建一个空白 DSV(单击 DSV 向导而不添加任何表)来解决此问题,而不是直接将表添加到 DSV,将它们添加为命名查询(右键单击空 DSV 并选择“新命名查询”。

这使您可以自己控制查询的文本,并设置自己的标识符。

(我基于 SSIS 提出此建议2005 年,但我认为 2008 年的情况类似。)

I don't know a way to change the quoted identifier, but you may be able to get around this by creating a blank DSV (click through the DSV wizard without adding any tables) then, rather than adding the tables to the DSV directly, adding them as named queries (right-click the empty DSV and select "New Named Query".

This enables you control the text of the query yourself, and set your own identifiers.

(I'm making this suggestion based on SSIS 2005, but I think 2008 works in a similar way.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文