从excel工作表生成sql插入脚本 [英] Generate sql insert script from excel worksheet

查看:197
本文介绍了从excel工作表生成sql插入脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我可以从这个excel工作表中生成一个SQL插入脚本吗?

解决方案

我认为使用所提到的方法之一导入是非常理想的,如果它真的是一个大文件,但可以使用Excel创建插入语句: / p>

  =INSERT INTO table_name VALUES('& A1&','& &')

在MS SQL中,您可以使用:

  SET NOCOUNT ON 

放弃显示所有1行受影响的评论。如果你正在做很多行,并且错误,那么在一段时间内每次都会在语句之间放置一个GO。


I have a large excel worksheet that I want to add to my database.

Can I generate an SQL insert script from this excel worksheet?

解决方案

I think importing using one of the methods mentioned is ideal if it truly is a large file, but you can use Excel to create insert statements:

="INSERT INTO table_name VALUES('"&A1&"','"&B1&"','"&C1&"')"

In MS SQL you can use:

SET NOCOUNT ON

To forego showing all the '1 row affected' comments. And if you are doing a lot of rows and it errors out, put a GO between statements every once in a while

这篇关于从excel工作表生成sql插入脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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