Posted by Jens on 10/06/05 17:12
I would do the querying once and put the data in a temporary table:
<SQLCode>
DECLARE @Folder varchar(200)
DECLARE @Filename varchar(200)
DECLARE @Workbook varchar(200)
DECLARE @Sqlstring varchar(4000)
SET @FileName = 'SomeSheet.xls'
SET @Folder = 'C:\SomeFolder\'
Set @Workbook = 'SomeWorkbook'
SET @SQLString = 'SELECT * FROM OpenDataSource(
''Microsoft.Jet.OLEDB.4.0'',''Data Source="' + @Folder + @FileName +
'";User ID=Admin;Password=;Extended properties=Excel 5.0'')...' +
@Workbook
Create Table #SomeTable
(
<YourTableDefinitionhere>
)
INSERt INTO #SomeTable
EXEC(@SQLString)
</Do anything with the data>
</SQLCode>
HTH, Jens Suessmeyer.
Navigation:
[Reply to this message]
|