向 Excel 文件添加 2 个额外列
由于 Microsoft ODBC Excel 驱动程序不支持 ALTER TABLE/DELETE FROM(/UPDATE?) 语句,因此我使用其他方法在正确的位置获取正确的数据。
我在将 2 列添加到 Excel 工作表时仍然遇到一个问题。
有人告诉我使用:
SELECT *, newcol1, newcol1 INTO newExternalSheet FROM thisSheet;
这不起作用,因为驱动程序抱怨不存在的列。嗯,它并没有完全告诉我这一点,但它给出了一些关于参数丢失的模糊错误消息。
相信我,没有缺少任何参数,它还会针对这种情况给出错误消息。
SQL error: [Microsoft][ODBC Excel Driver] Too few parameters. Expected 2.
Since the Microsoft ODBC Excel Driver doesn't support ALTER TABLE/DELETE FROM(/UPDATE?) statements, I'm using alternative ways of getting the right data in the right place.
I still have one problem with getting 2 columns added to an excel sheet.
Someone told me to use:
SELECT *, newcol1, newcol1 INTO newExternalSheet FROM thisSheet;
This doesn't work, since the driver complains about non-existant columns. Well, it doesn't exactly tell me that, but it gives some vague error message about parameters missing.
Believe me, there are no parameters missing, it also gives that error message for this kind of situations.
SQL error: [Microsoft][ODBC Excel Driver] Too few parameters. Expected 2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来当您将
newcol1
传递给数据库时,它认为您正在指定参数或列名。此外,Excel 有时会感到困惑,因此将整个查询包装在Select * From (...) X
语句中会有所帮助。为什么不使用:It looks like when you pass
newcol1
to your database, it think you are specifying either a paramater or a column name. Also, Excel sometimes gets confused, so it helps to wrap your entire query in aSelect * From (...) X
statement. Why not use: