nc's world:

天行健,君子以自强不息
地势坤,君子以厚德载物

博客园 首页 新随笔 联系 订阅 管理
Declare @num int

set @num =0

while(@num<9)
begin

    
set @num= @num + 1
    
if not exists(Select Attrid FROM HVC_Statistics_Setting WHERE Attrid =@num)
    
begin
        
INSERT INTO HVC_Statistics_Setting(PortalID,AttrID,AttrName,StringValue,FloatValue) 
        
VALUES (@PortalID,@num,'','',Case
        
When @num=1 then @TotalAccessed
        
When @num=2 then @AllArticlesNum
        
When @num=3 then @AllArticleHits
        
When @num=4 then @MonthTotalUpdated
        
When @num=5 then @MonthArticleHits
        
When @num=6 then @WeekArticleUpdated
        
When @num=7 then @WeekArticleHits
        
When @num=8 then @Score
        
end)
    
end
    
else
    
begin
    
Update HVC_Statistics_Setting SET
    PortalID
=@PortalID,
    AttrID
=@num,
    AttrName
='',
    StringValue
='',
    FloatValue
= Case
        
When  @num=1 then @TotalAccessed
        
When @num=2 then @AllArticlesNum
        
When @num=3 then @AllArticleHits
        
When @num=4 then @MonthTotalUpdated
        
When @num=5 then @MonthArticleHits
        
When @num=6 then @WeekArticleUpdated
        
When @num=7 then @WeekArticleHits
        
When @num=8 then @Score
        
end
    
where Attrid =@num
    
end
end
posted on 2006-08-30 08:39  nicesnow  阅读(781)  评论(0编辑  收藏  举报