I'm reading some excel spreadsheets into SQL Server tables. Can anyone tell me why I can do this...
SELECT * INTO TestImport FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=E:\MyFolder\MyExcelFile.xls;Extended Properties=Excel 8.0')...[Sheet1$]
But I can't do this...
DECLARE @FileName NVARCHAR(250)
SET @FileName = 'E:\MyFolder\MyExcelFile.xls'
SELECT * INTO TestImport FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=' + @FileName + ';Extended Properties=Excel 8.0')...[Sheet1$]