Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.
declare @TempAv int
declare @TempVar int
declare @temp int
declare @rain int
While @count <= (Select top 1 [num] from Map order by [num] desc)
BEGIN
--Get Variables for this area
set @TempAv = (Select [TempAv] from [map] where [num]=@count)
set @TempVar = (Select [TempVar] from [map] where [num]=@count)
--Set Temperature
If @Season = '0'
set @temp = @TempAv + convert(int, 0 + @TempVar * RAND(CHECKSUM(NEWID()))) - (@TempVar / 2)
Else if @Season = '1'
set @temp = @TempAv + convert(int, 0 + @TempVar * RAND(CHECKSUM(NEWID()))) + (@TempVar / 2)
Else if @Season = '2'
set @temp = @TempAv + convert(int, 0 + @TempVar * RAND(CHECKSUM(NEWID()))) - (@TempVar / 2)
Else if @Season = '3'
set @temp = @TempAv - convert(int, 0 + @TempVar * RAND(CHECKSUM(NEWID()))) - (@TempVar / 2)
update Map
Set [TempNow] = @temp where [num] = @count
END
update Map
Set [TempNow] = TempAv + CASE @Season WHEN '3' THEN -1 ELSE 1 END * CAST(0 + @TempVar * RAND(CHECKSUM(NEWID()))) - TempVar / 2 AS INT);
update Map
Set [TempNow] = TempAv
+ CASE @Season
WHEN '3' THEN -1
ELSE 1
END * CAST(0 + @TempVar * RAND(CHECKSUM(NEWID())) AS INT)
- CASE @Season
WHEN '1' THEN -1
ELSE 1
END * (TempVar / 2);
update [Map]
set [TempNow] = case @Season when '0' then TempAv + convert(int, 0 + TempVar * RAND(CHECKSUM(NEWID()))) - (TempVar / 2)
when '1' then TempAv + convert(int, 0 + TempVar * RAND(CHECKSUM(NEWID()))) + ( TempVar / 2)
when '2' then TempAv + convert(int, 0 + TempVar * RAND(CHECKSUM(NEWID()))) - ( TempVar / 2)
when '3' then TempAv - convert(int, 0 + TempVar * RAND(CHECKSUM(NEWID()))) - ( TempVar / 2)
else 0
end
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Sum Totals based on current date compared to fiscal year to get YTD totals | 3 | 29 | |
Oracle Stored Procedure for User Account data | 2 | 28 | |
Please help with the below query - SQL Server | 11 | 18 | |
How to use three values with DATEDIFF | 3 | 22 |
Join the community of 500,000 technology professionals and ask your questions.