--alter table temp_imatgeneral add id int identity(1,1)
字符串索引定位(patindex)+字符串重复(REPLICATE)+字符串长度函数(len)
select
substring(matcode,0,patindex('%[0-9]%',matcode))
+REPLICATE('0',6-len(matcode))
+substring(matcode,patindex('%[0-9]%',matcode),len(matcode)-1)
as matcode,matcode as x from temp_matcodeinfo where len(matcode)<6
sql设置事务回滚
begin tran
exec p_MFGWORtgCompleteDocConfirm 'PCG22030009','SYSTEM', 1
rollback