创建SQL脚本 [英] creating SQL script
本文介绍了创建SQL脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个SQL脚本来自动将值插入表中.
I'm trying to create an SQL script to automatize inserting of values into a table.
我有一个包含两列的表table1:键,值.
I have a table table1 with 2 columns: key, value.
我想插入几行:
INSERT INTO table1 (key, value) VALUES ("tomato1","random_value_1")
INSERT INTO table1 (key, value) VALUES ("tomato2","random_value_2")
INSERT INTO table1 (key, value) VALUES ("tomato3","random_value_3")
INSERT INTO table1 (key, value) VALUES ("tomato4","random_value_4")
如何将其放入可以从命令行执行的shell脚本中.
How can I put this into a shell script that I can execute from command line.
谢谢
推荐答案
另存为扩展名为.sql的文件.
save as a file with .sql extension.
然后使用诸如SQLPLus之类的sql连接工具从命令行运行(您无需指明所使用的数据库)
then run from the command line with a sql connection tool like SQLPLus (you don't indicate which database you are on)
这篇关于创建SQL脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文