The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled SQL Code
Posted by: PJ | August 4, 2010 @ 2:55am
SQL Code
[
Download
]
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[SP_Update_Device] -- Add the parameters for the stored procedure here @P_IEEE varchar(50), @P_Current_val Decimal, @P_Type int AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; IF EXISTS (SELECT IEEE FROM Devices WHERE IEEE = @P_IEEE) IF (SELECT MaxTemp FROM Devices WHERE IEEE = @P_IEEE) < @P_Current_val UPDATE Devices SET CurrentValue = @P_Current_val, Total = Total + @P_Current_val, Count_Total = Count_Total + 1, MaxTemp = @P_Current_val WHERE IEEE = @P_IEEE ELSE IF (SELECT MinTemp FROM Devices WHERE IEEE = @P_IEEE) > @P_Current_val UPDATE Devices SET CurrentValue = @P_Current_val, Total = Total + @P_Current_val, Count_Total = Count_Total + 1, MinTemp = @P_Current_val WHERE IEEE = @P_IEEE ELSE INSERT INTO Devices (IEEE, FK_Type, CurrentValue, Total, Count_Total, MaxTemp, MinTemp) values (@P_IEEE, @P_Type, @P_Current_val, @P_Current_val ,1, @P_Current_val, @P_Current_val); END
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.51 / 8
39 Votes
http://codebin.yi.org/774
page generated in 0.01 seconds