gpt4 book ai didi

sql-server - SQL Server : DELETE FROM OPENDATASOURCE

转载 作者:行者123 更新时间:2023-12-03 02:10:44 25 4
gpt4 key购买 nike

这有效:

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 来实现此目的。

最佳答案

您无法通过 OPENDATASOURCE 删除整行。根据http://support.microsoft.com/kb/257819 :

Delete

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:

  • Delete an entire record at once or you receive the following error message:

Deleting data in a linked table is not supported by this ISAM.

You can only delete a record by blanking out the contents of each individual field.

  • Delete the value in a cell containing an Excel formula or you receive the following error message:

Operation is not allowed in this context.

  • You cannot delete the empty spreadsheet row(s) in which the deleted data was located, and your recordset will continue to display empty records corresponding to these empty rows.

关于sql-server - SQL Server : DELETE FROM OPENDATASOURCE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16849296/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com