DECLARE
@Service_Id INTSET
@Service_Id = 2SELECT
TOP 1000 service_id ,* FROM dbo . MgtRpt_Inspected_OrderWHERE
1 = 1AND
CASE WHEN @Service_Id =- 1 THEN - 1 ELSE Service_Id END = @Service_IdORDER
BY tran_ser_id DESCDECLARE
@Service_Id INTSET
@Service_Id = 2SELECT
TOP 1000 service_id ,* FROM dbo . MgtRpt_Inspected_OrderWHERE
1 = 1AND
CASE WHEN @Service_Id =- 1 THEN - 1 ELSE Service_Id END = @Service_IdORDER
BY tran_ser_id DESC转载于:https://www.cnblogs.com/miaomiaoga/archive/2010/12/13/1904360.html