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