如何同时运行多条sql语句?急急急

在database desktop中运行多条sql语句,显示错误
如:Insert Into ZYBM Values("101","电子")
Insert Into ZYBM Values("102","机械")

语句是要有断句的,,,用【;】分号隔开

sql写法有问题,是这样写的
INSERT INTO student VALUES(NULL,'高宗',23,1,2),(NULL,'高旭',28,0,1);
//如果要在一次既要执行查询,又要修改或者插入,就得创建函数或者存储过程

Insert Into ZYBM Values("101","电子"); Insert Into ZYBM Values("102","机械");

Insert Into ZYBM Values("101","电子")
go
Insert Into ZYBM Values("102","机械")
go

INSERT INTO 表名
select 字段名1,字段名2 UNION
select 字段名1,字段名2

这是多行插入

建议看看这本书 <> 或看看这篇总结文章:http://blog.csdn.net/thinking_fioa/article/details/78265745

语句之间分号隔开就可以了。

分号表示上一条语句结束,Insert Into ZYBM Values("101","电子");Insert Into ZYBM Values("102","机械")
这样虽然不会报错,但是实际还是先运行第一句,再运行第二句

"在database desktop中运行多条sql语句,显示错误 "
对于oracle, 每条语句必须以分号结束;
对于sql server,每条语句后的分号可选,但是两种情形下必须加分号:
There are two situations in which you must use the semicolon.
The first situation is where you use a Common Table Expression (CTE),
and the CTE is not the first statement in the batch.
The second is where you issue a Service Broker statement
and the Service Broker statement is not the first statement in the batch.

另外,如果不加事务,语句的执行是逐条进行的,既不能保证数据原子性和完整性。