12345678910111213141516171819202122232425262728293031 |
- use db
- declare @orcount int
- declare @orid nvarchar(50)
- declare @jddate nvarchar(50)
- select @orcount=count(id) from dindan where (time2='' or time2 is null) and id in(select id from dindanjd where date<>'' and date is not null)
- while @orcount > 0
- begin
- select top 1 percent @orid=id from dindan where (time2='' or time2 is null) and id in(select id from dindanjd where date<>'' and date is not null)
- select @jddate=date from dindanjd where id = @orid and (date <> '' or date is not null)
- if (@jddate <> '' and @jddate is not null)
- update dindan set time2 = @jddate where id = @orid
- set @orcount=@orcount-1
- end
|