原来的公司,在存储数据的时候,都是将数据存储在excel里面的,这也是大家用得最多、最熟悉的,但是随着公司做系统开发,就不可能继续放在excel里面操作了,因为这个就不方便了,我们公司也是这样的。
下面介绍一个非常简单的方法,可以一次性搞定你的所有数据库,并且不用什么外部工具之类,也不用什么命令。
如在excel里面有如下表格
<!--[if gte vml 1]><v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
filled="f" stroked="f">
<v:stroke joinstyle="miter" />
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0" />
<v:f eqn="sum @0 1 0" />
<v:f eqn="sum 0 0 @1" />
<v:f eqn="prod @2 1 2" />
<v:f eqn="prod @3 21600 pixelWidth" />
<v:f eqn="prod @3 21600 pixelHeight" />
<v:f eqn="sum @0 0 1" />
<v:f eqn="prod @6 1 2" />
<v:f eqn="prod @7 21600 pixelWidth" />
<v:f eqn="sum @8 21600 0" />
<v:f eqn="prod @7 21600 pixelHeight" />
<v:f eqn="sum @10 21600 0" />
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" />
<o:lock v:ext="edit" aspectratio="t" />
</v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style='width:243pt;
height:48pt'>
<v:imagedata src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\02\clip_image001.png"
o:title="" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
假如这里面数据很多,我们不可能一条一条的去录入,我只是只是兴例,其它的都是类似搞定,此时我们把光标放到E1格里面,然后在公式栏里面输入如下公式:
="insert into t values('"&A1&"','"&B1&"','"&C1&"','"&D1&"')"
这里的t表示表名,可以得到如下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1026"
type="#_x0000_t75" style='width:414.75pt;height:47.25pt'>
<v:imagedata src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\02\clip_image003.png"
o:title="" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
然后拖动公式往下,就可以将所有的数据生成SQL语句了。
<!--[if gte vml 1]><v:shape id="_x0000_i1027" type="#_x0000_t75" style='width:414.75pt;height:48pt'> <v:imagedata src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\02\clip_image005.png" o:title="" /> </v:shape><![endif]--><!--[if !vml]-->
然后全部复制出,粘贴到执行SQL语的编辑器里一下就OK了<!--[endif]-->