随笔分类 - sql
摘要:declare My CURSOR for (select px from ksbmb) open My declare @a int set @a = 6 FETCH NEXT from my WHILE @@fetch_status = 0 BEGIN set @a=@a+1 print @a UPDATE KSBMB set px=@a+1 WHERE CUR...
阅读全文
posted @ 2016-12-05 20:31
刀小爱
摘要:insert into zcy (pm,gg,kcsl,pym) output inserted.pym values ('111','dd',1,'ddd') SCOPE_IDENTITY 和 @@IDENTITY 返回在当前会话中的任何表内所生成的最后一个标识值。但是,SCOPE_IDENTITY 只返回插入到当前作用域中的值;@@IDENTITY 不受限于特定的作用域。 例如...
阅读全文
posted @ 2016-10-24 14:29
刀小爱
摘要:select * from (select row_number() over (order by ypbsm)as num , * from ypbzb ) as a where num>=1 and num<=10
阅读全文
摘要:1 --SELECT @@error // 全局错误 默认是0 2 3 BEGIN TRANSACTION 4 TRUNCATE TABLE cfb5 SAVE TRANSACTION a 6 DELETE from ksbmb 7 ROLLBACK TRANSACTION a 返回到a的...
阅读全文
摘要:declare @x int set @x=1 while (@x<=100)beginprint @xset @x=@x+1end
阅读全文

浙公网安备 33010602011771号