declare @subject nvarchar(50) set @subject=(select Subject from dbo.Scores where ID=1)
insert into dbo.Student values (‘王五‘,‘男‘,40);select @@IDENTITY; insert into dbo.Student output inserted.ID values (‘李六‘,‘男‘,41)
declare @name nvarchar(50)=‘王五‘ if(@name=‘王五‘) begin select ‘true‘ end else begin select ‘false‘ end
declare @int int=1; declare @total int=0; while(@int<=100) begin set @total=@total+@int; set @int=@int +1; end select @total
原文:http://www.cnblogs.com/mongo/p/4434827.html