insert into promary values(1,'北京市')
insert into promary values(2,'天津市')
insert into promary values(3,'上海市')
insert into promary values(4,'重庆市')
insert into promary values(5,'河北省')
这段代码没有分号,也可以在MS SQL中运行呀
8 个解决方案
#1
用到公用表表达式 (CTE) 的时候,需要在with前用分号的.
#2
MSSQL中语句分隔符;是可选的.有没有都可以,不过一般为了规范可以加上去,增加易读性
#3
曾经发现过一段这样的资料:
从一些英文文献中发现:
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.
详见:
Sqlserver 中必须使用分号的两种情况--【叶子】
从一些英文文献中发现:
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.
详见:
Sqlserver 中必须使用分号的两种情况--【叶子】
#4
分号可要可不要!
#5
额 是啊 分号好像是用来 规范代码的 可要可不要嘛 再说SQL 中语法 是选中执行的.....
#6
你好厉害,都看英文文献的呀。请教下,insert 语句,返回-1,0,1等数值代表的意思呗
#7
0表示没有插入 1表示插入了一条。
返回的这个值,应该是受影响的函数,貌似不应该出现-1
#8
不错,强大!
#1
用到公用表表达式 (CTE) 的时候,需要在with前用分号的.
#2
MSSQL中语句分隔符;是可选的.有没有都可以,不过一般为了规范可以加上去,增加易读性
#3
曾经发现过一段这样的资料:
从一些英文文献中发现:
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.
详见:
Sqlserver 中必须使用分号的两种情况--【叶子】
从一些英文文献中发现:
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.
详见:
Sqlserver 中必须使用分号的两种情况--【叶子】
#4
分号可要可不要!
#5
额 是啊 分号好像是用来 规范代码的 可要可不要嘛 再说SQL 中语法 是选中执行的.....
#6
你好厉害,都看英文文献的呀。请教下,insert 语句,返回-1,0,1等数值代表的意思呗
#7
0表示没有插入 1表示插入了一条。
返回的这个值,应该是受影响的函数,貌似不应该出现-1
#8
不错,强大!