declare @mydate datetime declare @myear varchar(4) declare @mmonth varchar(2) declare @mday varchar(2) declare @mid int declare @str varchar(10) declare mycursor cursor for select MyYear,MyMonth,MyDay,id from weather
open mycursor fetch next from mycursor into @myear,@mmonth,@mday,@mid while @@fetch_status = 0 begin set @str = @myear + '-' + @mmonth + '-' + @mday set @mydate = convert(datetime, @str) update weather set Mydate = @mydate where id = @mid fetch next from mycursor into @myear,@mmonth,@mday,@mid end close mycursor deallocate mycursor 运行了好几个小时,有些转换成功了,有些没有。速度太慢,请问有人知道为什么吗?是SQLServer的问题吗?
----------------------------------------------
-