DECLARE @PATH NVARCHAR(1000) = N'\\MY-SERVER\C$\Folder\\'
DECLARE @TABLE NVARCHAR(50) = SUBSTRING(@FILENAME,0,CHARINDEX('.',@FILENAME))
DECLARE @SQL NVARCHAR(4000) =
N'IF OBJECT_ID(''dbo.' + @TABLE + ''' , ''U'') IS NOT NULL
DROP TABLE dbo.[' + @TABLE + ']
SELECT * INTO [' + @TABLE + ']
FROM OPENROWSET(''Microsoft.ACE.OLEDB.12.0''
,''Text; Database='+@PATH+';''
,''SELECT * FROM [' + @FILENAME + ']'')'
EXEC(@SQL)
Today I ran into a problem with the Microsoft.ACE.OLEDB.12.0 driver in SSIS 2012. The script above is in the stored procedure, which dynamically loads the CSV into the database based on the current file, which is delivered through the SSIS loop in which the stored procedure is stored. There are files in the directory.
The stored procedure runs correctly when executed directly in SQL Server Management Studio.
It works to this day. Today I get the following error:
"EXEC [dbo]. [CreateAndImportCSVs]?" : " OLE DB" Microsoft.ACE.OLEDB.12.0 " " (null) ".". : , ResultSet , .
!
Edit
, , , , Windows, ! :
Microsoft Office Access Runtime 2007 (SP3)
http://support.microsoft.com/kb/2526310
Microsoft Office 2007 (KB967642)
http://www.microsoft.com/downloads/details.aspx?FamilyId=E93AB1BE-ADE6-4FF8-8637-DBD3EBE3C5C5&displaylang=en