declare @CompanyName varchar(360)
declare @Address    varchar(600)
declare @LinkMan    varchar(120)
declare @Tel    varchar(64)
declare @Mobile    varchar(64)
declare @Fax    varchar(120)
declare democursor cursor

for
select CompanyName,Address,LinkMan,Tel,Mobile,Fax from Company
open democursor
fetch next from democursor into @CompanyName,@Address,@LinkMan,@Tel,@Mobile,@Fax

while @@FETCH_STATUS=0

begin

print 'update Companyinfo set CompanyAdderss='''+@Address+''',PAddress='''+@Address+''',PTel='''+@Tel+''',PPhone='''+@Tel+''',PMobile='''+@Mobile+''',PFax='''+@Fax+''' where CompanyName='''+@CompanyName+''' and PTel is null'
fetch next from democursor into @CompanyName,@Address,@LinkMan,@Tel,@Mobile,@Fax

end

close democursor
deallocate   democursor

posted on 2009-03-03 10:22  bestsaler  阅读(157)  评论(0编辑  收藏  举报