declare @file varchar(100) Declare @Str varchar(1000) drop table TempUnitUpdn4 set @file = 'test' Create table TempUnitUpdn4 ( col1 Varchar(05), col2 Varchar(05), col3 Varchar(10), col4 Varchar(100) ) Set @Str = 'Insert into TempUnitUpdn4 Select Company,Department,UserID,[Proposed action] FROM OPENROWSET(''Microsoft.ACE.OLEDB.12.0'',''Excel 12.0 Xml;IMEX=1;Database=D:\'+@file+'.xlsx;'', ''SELECT * FROM [Sheet1$]'')' print(@str) execute(@str)
OLE DB provider 'Microsoft.ACE.OLEDB.12.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)