You are here: Re: Use variable for datasource in Opendatasource « MsSQL Server « IT news, forums, messages
Re: Use variable for datasource in Opendatasource

Posted by Erland Sommarskog on 05/05/06 01:05

(lonestarprogramming@gmail.com) writes:
> I can make this run in the Query Analyzer:
> SELECT * INTO Audit
> FROM OPENDATASOURCE( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source = ''C:\Spreadsheets\Audits.xls\Audit_TC.xls'';Extended
> Properties=Excel 8.0')...Audit$
>
> I could run the SQL directly from my app, but I like to use stored
> procs whenever I can for the speed and flexibility. I can change the
> stored proc and not have to recompile/reinstall the app.

To do this in a stored procedure, you would have to use dynamic SQL.
See http://www.sommarskog.se/dynamic_sql.html for details.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

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

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