--用游标 declare @str varchar(100) --定义游标 declare DZCursor CURSOR for SELECT test_str FROM test where test_str='xxx' --打开游标 open DZCursor --从游标取记录 fetch next from DZCursor into @str --当有记录 while @@fetch_status=0 begin insert into test (test_str) values ('xxx') --取下一条记录 fetch next from DZCursor into @str end --关闭游标 close DZCursor --删除游标引用 deallocate DZCursor