向一个表A中插入记录,并且插入的记录在A中不存在(通过一个字段来判断)

 insert into trace_users (tracekey,muteSMS,CreateTime,traceuser,tracetime,traceSlot,traceduration)
  select 'TRACE_TIMER',0,getdate(),mobileid,getdate(),'30','0'
  from Epm_EmployeeList where corpid = 10001
  and mobileid not in (select traceuser from trace_users )
  and mobileid like '13%' and len(mobileid) = 11

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/qiubgstudy/archive/2007/12/04/1915596.aspx

你可能感兴趣的:(插入)