You are here: Re: Import cell data from XLS into SQL table « MsSQL Server « IT news, forums, messages
Re: Import cell data from XLS into SQL table

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация