小小菜鸟向大家请教一个问题
<P>小小菜鸟向大家请教一个问题<BR>能告诉我这段代码里面究竟出了什么问题吗<BR>本算法的目的:根据表中的 post_value 字段找出符合条件的记录<BR>谢谢大家了!<BR>declare t_media_post_cursor cursor for<BR>select post_id,post_mobilenum,post_value<BR>from t_media_post<BR>open t_media_post_cursor<BR>go<BR>declare @count int(1),@i int(3),@subvalue varchar(5)<BR>declare @post_id int(3),@post_mobilenum varchar(15),@post_value varchar(255)<BR>set @count=0<BR>set @i=0<BR>fetch next from t_media_post_cursor<BR>into @post_id,@post_mobilenum,@post_value <BR>while @@fetch_status <> -1<BR>begin<BR> while @count<=3<BR> begin<BR> @subvalue=substr(@post_value,1,@i)<BR> if @subvalue not in ('A','C','D','F','G','H','K','L')<BR> @count=@count+1<BR> @i=@i+1 <BR> end if <BR> end<BR> if @count<3<BR> print ' @post_id,@post_mobilenum,@post_value'<BR> end if<BR>fetch next from t_media_post_cursor<BR>into @post_id,@post_mobilenum,@post_value <BR>end<BR>close t_media_post_cursor<BR>DEALLOCATE t_media_post_cursor</P>页:
[1]
