English 中文(简体)
如何在T-SQL中从DSN中的表中选择数据?
原标题:
  • 时间:2008-10-28 15:21:04
  •  标签:

我该如何在T-SQL MS SQL Server的任何版本中,从只能通过ODBC数据源(DSN)访问的数据库中获取数据?

最佳回答

阅读以下内容后,我决定创建SSIS包通过DSN从另一个数据源获取数据。

With Linked Servers, you have a little more flexibility, but also some additional security concerns. You are linking to the other data source as a specific user, with that user s authority to the linked server. If all you need is Read-only access to a few views, that user should only be granted that authority to those objects. This isn t so bad, you have total control of the authority you grant to that user, but you have to manage it and realize that granting too much authority could be a security concern.

Consider using a linked server with read-only rights to copy data from specific tables/view into permanent tables in the other database in lieu of an SSIS package. You can execute a job periodically to copy the appropriate data from the linked server to the local database and reference the local tables within your application. It will likely be easier to implement and maintain than an SSIS package, and could potentially be updated later to make it a live solution.

来源:http://www.eggheadcafe.com/software/aspnet/32465151/linked-servers-versus-ssi.aspx

问题回答

选择是容易的部分,但真正的问题是如何连接到数据源。

首先,您从哪里选择数据?您是编写代码,还是只使用查询分析器工具(2000)或管理工作室(2005)?

无论如何,您需要设置到数据库的连接。如果您需要连接到DSN的连接字符串帮助,请访问网站www.connectionstrings.com。否则,从查询工具中会有对话框或向导来帮助您。

您需要将一个Linked Server添加到源中,然后您就可以像平常一样查询它。





相关问题
热门标签