SQL gets the maximum sort number and accumulates 1 custom function

zhaozj2021-02-16  58

/ ************************************************** ********************* Function Name: getMaxSqrt (@SQRTTYPE) Parameters: @SQRTTYPE Defines Table @maxsqrtid with Values: Return to Max (SQRT) 1 Return Number Power by adpostemail: ZRSZ@hotmail.com **************************************************** ************************************************ / CREATE FUNCTION GETMAXSQRT (@SQRTTYPE AS INT) Returns INTWITH ENCRYPTIONASBEGIN DECLARE @MaxSqrtid as INT IF (@ SqrtType = 1) begin select @MaxSqrtID = max (CategorySqrt) from LXBIZ_Category end if (@ SqrtType = 2) begin SELECT @MaxSqrtID = max (SubClassSqrt) fROM LXBIZ_SubClass end if (@MaxSqrtID is null) begin select @MaxSqrtID = 0 end return @ MaxSqrtid 1END

转载请注明原文地址:https://www.9cbs.com/read-21896.html

New Post(0)