这有效:
SELECT * FROM OPENDATASOURCE(
'Microsoft.ACE.OLEDB.12.0',
'Data Source=d:\JobFiles\MyFile.xlsx;
Extended properties=Excel 8.0')...MySheet$
也是这样:
INSERT INTO OPENDATASOURCE(
'Microsoft.ACE.OLEDB.12.0',
'Data Source=d:\JobFiles\MyFile.xlsx;
Extended properties=Excel 8.0')...MySheet$
SELECT * FROM blahblahblah
那为什么不呢?
DELETE FROM OPENDATASOURCE(
'Microsoft.ACE.OLEDB.12.0',
'Data Source=d:\JobFiles\MyFile.xlsx;
Extended properties=Excel 8.0')...MySheet$
我做了一些搜索,但没有真正的运气.归根结底,我需要的只是在插入新数据之前删除 excel 行,我只想使用 SQL 来实现这一点.
I've done some searching with no real luck. At the end of the day, all I need is the excel rows deleted before I can insert fresh data and I want to achieve this with SQL only.
您不能通过 OPENDATASOURCE 删除整行.根据 http://support.microsoft.com/kb/257819:
You cannot delete entire rows via OPENDATASOURCE. According to http://support.microsoft.com/kb/257819:
删除
与删除 Excel 数据相比,您在删除 Excel 数据方面受到更多限制关系数据源.在关系数据库中,行"没有意义或记录"之外的存在;在 Excel 工作表中,这不是真的.您可以删除字段(单元格)中的值.但是,您不能:
You are more restricted in deleting Excel data than data from a relational data source. In a relational database, "row" has no meaning or existence apart from "record"; in an Excel worksheet, this is not true. You can delete values in fields (cells). However, you cannot:
此 ISAM 不支持删除链接表中的数据.
您只能通过清空每个记录的内容来删除记录个人领域.
You can only delete a record by blanking out the contents of each individual field.
在这种情况下不允许操作.
这篇关于SQL Server:从 OPENDATASOURCE 中删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
将每个子标记转换为具有多个分隔符的单列-SQLConverting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(将每个子标记转换为具有多个分隔符的单列-SQ
如何从多个表创建视图?How can I create a view from more than one table?(如何从多个表创建视图?)
根据前一行内的计算值创建计算值Create calculated value based on calculated value inside previous row(根据前一行内的计算值创建计算值)
如何将表格的前两列堆叠成一列,但也仅将第三How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何将表格的前两列堆
递归 t-sql 查询Recursive t-sql query(递归 t-sql 查询)
将月份名称转换为日期/月份编号(问题和答案的组Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(将月份名称转换为日期/月份编号(问题和答案的组合