SQL Loop dynamic select "equals" in stored procedure -
i trying following , not understand why not work. not understand.
declare @month_1 nvarchar(50) declare @month_2 nvarchar(50) declare @month_3 nvarchar(50) declare @intflag nvarchar(50) set @intflag = 1 while (@intflag <=3) begin select '@month' +'_'+ @intflag = datepart(month, getdate()) print '@month' +'_'+ @intflag set @intflag = @intflag + 1 end go
Comments
Post a Comment