日期:2014-05-17 浏览次数:21164 次
DECLARE @CauseCode VARCHAR(10) ,
@ProtocolCode VARCHAR(10) ,
@line VARCHAR(20) ,
@tmp VARCHAR(10)
DECLARE mycur CURSOR
FOR
SELECT ROW_NUMBER() OVER ( ORDER BY t.AUTHReqTime ASC ) ,
t.CauseCode ,
t.ProtocolCode
FROM T_WLan_CDR_Portal t FOR UPDATE
BEGIN
OPEN mycur ;
FETCH NEXT FROM mycur INTO @line, @CauseCode, @ProtocolCode ;
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT '行号:' + @line + '协议码:' + @ProtocolCode + ' 错误码:'
+ @CauseCode ;
SET @tmp = @ProtocolCode ;
SET @ProtocolCode = @CauseCode ;
SET @CauseCode = @tmp ;
PRINT '行号:' + @line + '协议码:' + @ProtocolCode + ' 错误码:'
+ @CauseCode ;
UPDATE T_WLan_CDR_Portal
SET CauseCode = @ProtocolCode ,
ProtocolCode = @CauseCode
WHERE CURRENT OF mycur ;
FETCH NEXT FROM mycur INTO @line, @CauseCode, @ProtocolCode ;