set @i=行号=@i+1 这是什么语法呀,等号可以连续赋值set @i=行号=@i+1本以为是错误的语法,自己测试了一下,竟然是正确的,我晕了,以前没见过这种语法呀?
drop table #tbcreate table #tb(autoid int identity(581080,1),行号 int,b varchar(10))insert #tb (b)
select 'aaa' union all
select 'bbb' union all
select 'ccc' union all
select 'ddd' union all
select 'eee'--以下代码为何执行正确呢?
-- set @i=行号=@i+1 这是什么语法呀,等号可以连续赋值
declare @i int
set @i = 0
update #tb set @i=行号=@i+1select *
from #tb
drop table #tbcreate table #tb(autoid int identity(581080,1),行号 int,b varchar(10))insert #tb (b)
select 'aaa' union all
select 'bbb' union all
select 'ccc' union all
select 'ddd' union all
select 'eee'--以下代码为何执行正确呢?
-- set @i=行号=@i+1 这是什么语法呀,等号可以连续赋值
declare @i int
set @i = 0
update #tb set @i=行号=@i+1select *
from #tb
解决方案 »
- 怎样查询出SQLSERVER被锁的表,以锁表的SQL语句
- 急 高手快来帮下 在线等
- 菜鸟求救 :如何在更新st表的同时更新sc表中对应的字段
- (急)sql server 2005中使用ssis包倒数据时出现错误,谢谢了。
- 客户sql2008r2数据库使用排序规则是Latin1_General_BIN,通过查询分析器查出来的中文是乱码怎么办?
- sql server2000里数据库改动问题?
- 如何按时间点恢复SQL数据啊!!!
- 一个关于汉字的问题,求助各位。
- char转换成numeric
- “查询选课程C1但不选C2的学生学号”这个代码咋写?
- 如果将SQL桌面版从计算机上移除?
- 如何把一条数据拆分成两段?
如果你能抽时间把精华帖都看一遍的话,就不会有这疑问了
update #tb set @i=行号=@i+1
--等于
update #tb set @i=行号,@id=@i+1
set @i = 0
update #tb set @i=行号=@i+1
UPDATE
{
table_name WITH ( < table_hint_limited > [ ...n ] )
| view_name
| rowset_function_limited
}
SET
{ column_name = { expression | DEFAULT | NULL }
| @variable = expression
| @variable = column = expression } [ ,...n ]