SQL高级应用之同服务器上复制表到另一数据库中并实现去重复
2014-06-27来源:易贤网

项目需求:将数据库Whir_ezMall_Full中的表Whir_Member的数据迁移到数据库Whir_ezMall_Full_c中的Whir_Member表,已存在的ID记录则不插入。

SQL语句:

代码如下:

INSERTINTOWhir_ezMall_Full_c..Whir_Member(MemberID,LevelID,Account,MemberPWD,Email,Integral,MemberName,MemberStatus,Sex,Birthday,Area,Adress,ZipCode,Tel,Mobile,SaveQuestion,SaveAnswer,CreateData,LastLoginData,ImgUrl,LimitIntegral,IntegralBeginTime,IntegralEndTime,memberType,BankType,BankRegion,BankAddress,BankAccount,BankName,IsQQ)

SELECTMemberID,LevelID,Account,MemberPWD,Email,Integral,MemberName,MemberStatus,Sex,Birthday,Area,Adress,ZipCode,Tel,Mobile,SaveQuestion,SaveAnswer,CreateData,LastLoginData,ImgUrl,LimitIntegral,IntegralBeginTime,IntegralEndTime,memberType,BankType,BankRegion,BankAddress,BankAccount,BankName,IsQQFROMWhir_ezMall_Full..Whir_Member

WHEREWhir_ezMall_Full..Whir_Member.MemberIDNOTIN(SELECTMemberIDFROMWhir_Member)

更多信息请查看IT技术专栏

推荐信息