2016-03-13 141 views
0

我是SQL Server的新手,但通常不是SQL或编程。我一直在阅读可用的在线文档和教程,以便设置一个对于SSDT/SSIS中的每个循环,它循环访问文件夹中的一系列平面文件,并为每个文件夹创建一个具有相同名称的DB对象。用于SQLServer2014的SSDT/SSIS中的动态OLE DB目标的连接字符串

该循环的工作原理除了设置OLE DB目标管理器的连接字符串。我的服务器被称为有一个名为“足球数据”,我使用了下面的连接字符串数据库“OLEGS_LAPTOP”:

"Provider=SQLNCLI11.0;Server=OLEGS_LAPTOP;Source=(local);Initial Catalog="+ @[User::FileFound] + "Football Data"+";Integrated Security=SSPI;Auto Translate=False;" 

这里,@[User::FileFound]代表的变平面文件连接管理器设置为通过文件循环在我选择的本地文件夹中。当我尝试使用此连接字符串的OLE DB对象,我得到以下错误:

TITLE: Package Validation Error 
------------------------------ 

Package Validation Error 

------------------------------ 
ADDITIONAL INFORMATION: 

Error at Data Flow Task [OLE DB Destination [10]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. 
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Unspecified error". 
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "The metadata could not be determined because every code path results in an error; see previous errors for some of these.". 
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Invalid object name 'dbo.OLE DB Destination'.". 

Error at Data Flow Task [OLE DB Destination [10]]: Failed to open a fastload rowset for "[dbo].[OLE DB Destination]". Check that the object exists in the database. 

Error at Data Flow Task [SSIS.Pipeline]: "OLE DB Destination" failed validation and returned validation status "VS_ISBROKEN". 

Error at Data Flow Task [SSIS.Pipeline]: One or more component failed validation. 

Error at Data Flow Task: There were errors during task validation. 

(Microsoft.DataTransformationServices.VsIntegration) 

------------------------------ 
BUTTONS: 

OK 
------------------------------ 

谁能告诉我,我需要在我的字符串得到期望的结果来改变?

感谢

继答案/支持到目前为止给出:

现在我收到的错误信息是:

TITLE: Package Validation Error 
------------------------------ 

Package Validation Error 

------------------------------ 
ADDITIONAL INFORMATION: 

Error at Data Flow Task [OLE DB Destination [10]]: A destination table name has not been provided. 

Error at Data Flow Task [SSIS.Pipeline]: "OLE DB Destination" failed validation and returned validation status "VS_ISBROKEN". 

Error at Data Flow Task [SSIS.Pipeline]: One or more component failed validation. 

Error at Data Flow Task: There were errors during task validation. 

(Microsoft.DataTransformationServices.VsIntegration) 

------------------------------ 
BUTTONS: 

OK 
------------------------------ 

回答

0

它看起来像某种方式字符串“OLE DB目标“进入table\view映射(第一张截图),[dbo].[OLE DB Destination]作为表名出来。也许你已经在OLE DB Destination属性窗口的OpenRowset属性(第二个屏幕截图)中用此字符串替换了表名。

enter image description here

enter image description here


以后编辑

为了能够从变量获取表名(假设你有一个分配给它的表名,变量)您需要将OLE DB DestinationAccessMode属性更改为OpenRowset From Variable,并在012中指定变量名称属性(见下图)

enter image description here

+0

您好,感谢回答。那么我应该如何在DB目的地编辑器中将其作为我的表名称?我试过使用'@ [User :: FileFound]',但编辑不会接受... – gdogg371

+0

我强烈建议您尝试让您的解决方案在第一次没有任何动态变量映射的情况下工作。连接字符串根本不包含表名。它仅包含服务器名称和数据库名称。 –

+0

检查帖子中的更改 –