SQLServer 6.5到SQLServer 2000日期格式转换
发布时间:2020-12-12 16:03:55 所属栏目:MsSql教程 来源:网络整理
导读:declare ??MyTestCursor? cursor for ? select ??applytime? from ?xh_log? open ?MyTestCursor declare ? @applytime ? varchar ( 50 ) fetch ? from ?MyTestCursor? into ? @applytime while ? @@FETCH_STATUS ? = ? 0 Begin if ( substring ( @applytime
declare
??MyTestCursor?
cursor
for ? select ??applytime? from ?xh_log? open ?MyTestCursor declare ? @applytime ? varchar ( 50 ) fetch ? from ?MyTestCursor? into ? @applytime while ? @@FETCH_STATUS ? = ? 0 Begin if ( substring ( @applytime , 6 , 2 ) = ' 一月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?一月? ' , ' -1- ' )? where ? substring (applytime, 2 ) = ' 一月 ' end else ? if ( substring ( @applytime , 2 ) = ' 二月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?二月? ' , ' -2- ' )? where ? substring (applytime, 2 ) = ' 二月 ' end else ? if ( substring ( @applytime , 2 ) = ' 三月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?三月? ' , ' -3- ' )? where ? substring (applytime, 2 ) = ' 三月 ' end else ? if ( substring ( @applytime , 2 ) = ' 四月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?四月? ' , ' -4- ' )? where ? substring (applytime, 2 ) = ' 四月 ' end else ? if ( substring ( @applytime , 2 ) = ' 五月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?五月? ' , ' -5- ' )? where ? substring (applytime, 2 ) = ' 五月 ' end else ? if ( substring ( @applytime , 2 ) = ' 六月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?六月? ' , ' -6- ' )? where ? substring (applytime, 2 ) = ' 六月 ' end else ? if ( substring ( @applytime , 2 ) = ' 七月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?七月? ' , ' -7- ' )? where ? substring (applytime, 2 ) = ' 七月 ' end else ? if ( substring ( @applytime , 2 ) = ' 八月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?八月? ' , ' -8- ' )? where ? substring (applytime, 2 ) = ' 八月 ' end else ? if ( substring ( @applytime , 2 ) = ' 九月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?九月? ' , ' -10- ' )? where ? substring (applytime, 2 ) = ' 九月 ' end else ? if ( substring ( @applytime , 2 ) = ' 十月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?十月? ' , 2 ) = ' 十月 ' end else ? if ( substring ( @applytime , 3 ) = ' 十一月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?十一月? ' , ' -11- ' )? where ? substring (applytime, 3 ) = ' 十一月 ' end else ? if ( substring ( @applytime , 3 ) = ' 十二月 ' ) begin update ?xh_log? set ?applytime = replace (applytime, ' ?十二月? ' , ' -12- ' )? where ? substring (applytime, 3 ) = ' 十二月 ' end fetch ? next ? from ?MyTestCursor? into ? @applytime End ???? close ?MyTestCursor deallocate ?MyTestCursor ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |