把一张表的 每行数据的 一个字段的值进行随机
declare @tid int declare topic_cur cursor for select tid from bbs_topics open topic_cur fetch next from topic_cur into @tid while (@@fetch_status=0) begin UPDATE [dbo].[bbs_topics] SET iconid=CEILING(rand()*15) WHERE tid=@tid fetch next from topic_cur into @tid end close topic_cur deallocate topic_cur