主题:着急!! 看看这这条奇怪的SQL源码!谢谢了!!
--好像计算有问题
DECLARE @CountType INT
SELECT @CountType = count(1) FROM CAR_RULE WHERE RULEINFO = @cRule
IF(@CountType <= 0)
BEGIN
UPDATE CAR_RULE
SET STATUS = @cStaus,ALERTTIME = @cALERTTIEM,
RULEINFO =CASE @cRule
WHEN 'A' THEN RULEINFO + 'A'
WHEN 'B' THEN RULEINFO + 'B'
WHEN 'C' THEN RULEINFO + 'C'
WHEN 'D' THEN RULEINFO + 'D'
WHEN 'E' THEN RULEINFO + 'E'
WHEN 'F' THEN RULEINFO + 'F'
WHEN 'G' THEN RULEINFO + 'G'
END WHERE CARID = @cCarId
END
-- 功能是如果RULEINFO有A就不做存储到数据库了,如果不存在就记录到数据库
DECLARE @CountType INT
SELECT @CountType = count(1) FROM CAR_RULE WHERE RULEINFO = @cRule
IF(@CountType <= 0)
BEGIN
UPDATE CAR_RULE
SET STATUS = @cStaus,ALERTTIME = @cALERTTIEM,
RULEINFO =CASE @cRule
WHEN 'A' THEN RULEINFO + 'A'
WHEN 'B' THEN RULEINFO + 'B'
WHEN 'C' THEN RULEINFO + 'C'
WHEN 'D' THEN RULEINFO + 'D'
WHEN 'E' THEN RULEINFO + 'E'
WHEN 'F' THEN RULEINFO + 'F'
WHEN 'G' THEN RULEINFO + 'G'
END WHERE CARID = @cCarId
END
-- 功能是如果RULEINFO有A就不做存储到数据库了,如果不存在就记录到数据库