存储过程

 

 1 SET NOCOUNT ON;
 2   declare @taba table(
 3             CityD int    ,
 4             Cityame  nvarchar    (50)
 5         )    
 6    insert into @taba  select CityID,CityName from T_City 
 7    
 8    declare @CityD int    ,
 9             @Cityame  nvarchar    (50)
10             
11    while EXISTS(select * from @taba)
12    begin
13      select top 1 @CityD=CityD ,@Cityame= Cityame from @taba 
14      Update  I_IPCity set CityID= @CityD   where  charindex(@Cityame,Area)   >0
15      delete top (1)   from @taba    
16    end

 

posted @ 2015-08-07 17:00  我_爱编程  阅读(266)  评论(0编辑  收藏  举报