View Code
insert into CUSTOMER_TYPE ( [ID] , [CUSTOMER_ID] , [CUSTOMER_TYPE] , [STATUS] , [DELETE_FLAG] , [CREATE_USER] , [CREATE_DATE_TIME] , [UPDATE_USER] , [UPDATE_DATE_TIME] ) select replace(newid(), '-', ''), id, 'C06', '1', '0', 'niudongling', getdate(), 'niudongling', getdate() from CUSTOMER where tax !=''
自动生成ID方法:newid()
去掉ID中的'-':replace(newid(), '-', '')
Insert Into Select语句的使用