Excel表中的SQL UPDATE数据库 [英] SQL UPDATE Database from Excel Table

查看:60
本文介绍了Excel表中的SQL UPDATE数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前在Access论坛发布了这个

,结果为负,所以会在这里试试。


虽然这个问题指定了一个Access数据库,但是/>
我也希望用我们拥有的大型MS SQL Server

数据库来实现这个目标。


问题如下:


以下SQL语句,在VBScript中使用,

将表格从Excel复制到Access mdb。


SQL = SELECT * INTO C1R0 &安培; _

"来自[C1R0 $] IN''''' &安培; _

" ''Excel 8.0; database = c:\ excel \UpdateFinal1.xls'';"


什么是SQL语句

UPDATE一个已经存在的Access表

包含Excel电子表格中的所有行?


电子表格和数据库的列是

相同。


谢谢

吉姆

I had previously posted this in an Access forum
with negative results so will try here.

Although this question specifies an Access database,
I also wish to accomplish this with a large MS SQL Server
database that we have.

Question follows:

The following SQL statement, used in VBScript,
will COPY a table from Excel to an Access mdb.

SQL = "SELECT * INTO C1R0" & _
" FROM [C1R0$] IN ''''" & _
" ''Excel 8.0;database=c:\excel\UpdateFinal1.xls'';"

What is the SQL statement that will
UPDATE an already existing Access table
with all rows from Excel spreadsheet?

The columns of both Spreadsheet and database are the
same.

Thanks
Jim

推荐答案

IN' '''" &安培; _

" ''Excel 8.0; database = c:\ excel \UpdateFinal1.xls'';"


什么是SQL语句

UPDATE一个已经存在的Access表

包含Excel电子表格中的所有行?


电子表格和数据库的列是

相同。


谢谢

吉姆

IN ''''" & _
" ''Excel 8.0;database=c:\excel\UpdateFinal1.xls'';"

What is the SQL statement that will
UPDATE an already existing Access table
with all rows from Excel spreadsheet?

The columns of both Spreadsheet and database are the
same.

Thanks
Jim




他们在访问论坛中通常都很好!所以你将不得不使用
来处理非访问者的回复!!


在SQL Server中你有


更新A

SET col1 = E.col1,

col2 = E.col2,

.....

来自C1R0 A

加入[C1R0
Hi

They are normally good on this in the access forums! So you will have to
make do with a non-access person''s reply!!

In SQL Server you have

UPDATE A
SET col1 = E.col1,
col2 = E.col2,
.....
FROM C1R0 A
JOIN [C1R0


E ON E.PK = A.PK


我不确定文件名会去哪里!!


你也可以使用类似的东西:


UPDATE C1R0

SET col1 =(SELECT col1 FROM [C1R0
E ON E.PK = A.PK

I am not sure where the filename would go!!

You can also use something like:

UPDATE C1R0
SET col1 = ( SELECT col1 FROM [C1R0


这篇关于Excel表中的SQL UPDATE数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆