SQL批量Insert脚本

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语句的使用

posted @ 2013-01-31 15:21  牛小花  阅读(910)  评论(1编辑  收藏  举报