您的位置:首页 > 数据库

记录几个sql语句

2010-09-28 15:08 274 查看
1、插入带时间与null值的

insert into product values(null,'','20422REV','','','','','','','','','','','','',getdate(),getdate(),'','hl-qc','','')

 

 

2、插入不重复的数据的

insert into product select other1,other2,other3,other4,other5,other6,other7 from product_temp where not exists(select * from product where other1=product_temp.other1 or other2=product_temp.other2)

 

insert into product select item,ref,other_item,rose_item,rose_len,leaf_item,leaf_len,base_item,base_len,others1,others2,others3,others4,item_check,qc_check,pic_date,add_date,adder,pic,pichave,item_sort from product2 where not exists(select * from product where item=product2.item or other_item=product2.other_item)

 

3、查询重复的数据的

select * from product_temp where not exists(select * from product where other1=product_temp.other1 or other2=product_temp.other2)

 

4、复制表结构的

select * into product1 from product where 1=2

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  sql insert date null