如何将Excel工作表数据更新或保存到Sql表中
问题描述:
我有一个数据库和很多表.
我想从Excel中插入和更新sql的数据.我可以将数据从sql检索到excel.但是我必须将数据从Excel工作表发送回sql并进行更改(如果有的话).
这是我的问题.
您能帮助任何人解决此问题吗?
提前谢谢.
Thiru.
Hi,
i have a database and lot of tables.
I want to insert and update the data of sql from excel. I can retrieve the data from sql to excel. But i have to send the data back to sql with the changes if any, from excel sheet.
This is my problem.
Can you help any one to solve this problem.
Thanks in advance.
Thiru.
答
关注他们:
如何将数据从Excel导入SQL Server [从Excel电子表格中插入,更新或删除SQL Server中的数据 [将数据从Excel导出到新的SQL Server表 [
Follow them:
How to import data from Excel to SQL Server[^]
Inserting, Updating or Deleting Data in SQL Server from an Excel Spreadsheet[^]
Export data from Excel to new SQL Server table[^]
:thumbsup:
我有一个解决方案.您可以通过使用Excel工作表中的连接公式在excel文件中创建命令.我给你一个例子
假设您有一个Excel工作表,并且字段位于单独的单元格中
itemcode itemname价格命令
将100茶100插入table_name
(商品代码,商品名称,价格)值(
然后将这些单元格连接到一个单元格中,然后一个单元格将使用值放置命令,然后拖动单元格以填充所有单元格.现在在sql server中复制命令的所有行并运行查询.因此通过此过程,您可以轻松地插入或删除或更新记录.
谢谢
Thiru i have a solution. you can create command in excel file by using concatenate formula in excel sheet. i am given you a example
Suppose you have a excel sheet and fields are in separate cell
itemcode itemname price command
100 tea 100 insert into table_name
(itemcode,itemname,price) values(
then you concatenate these cells in a cell then one cell will put command with values and then drag cells for populate all cells. now copy all rows of command in sql server and run query. so by this process you can easily inserted or deleted or updated records.
Thanks