SQL高級應(yīng)用之同服務(wù)器上復(fù)制表到另一數(shù)據(jù)庫中并實現(xiàn)去重復(fù)
更新時間:2014年06月05日 09:49:36 作者:
項目需求:將數(shù)據(jù)庫Whir_ezMall_Full中的表Whir_Member的數(shù)據(jù)遷移到數(shù)據(jù)庫Whir_ezMall_Full_c中的Whir_Member表,已存在的ID記錄則不插入
SQL語句:
復(fù)制代碼 代碼如下:
INSERT INTO Whir_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)
SELECT 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 FROM Whir_ezMall_Full..Whir_Member
WHERE Whir_ezMall_Full..Whir_Member.MemberID NOT IN (SELECT MemberID FROM Whir_Member)
您可能感興趣的文章:
- 解析mysql中:單表distinct、多表group by查詢?nèi)コ貜?fù)記錄
- sqlserver 用戶權(quán)限管理,LINQ去除它的重復(fù)菜單項
- sqlserver利用存儲過程去除重復(fù)行的sql語句
- mysql SELECT語句去除某個字段的重復(fù)信息
- Mysql刪除重復(fù)的數(shù)據(jù) Mysql數(shù)據(jù)去重復(fù)
- MySQL中distinct語句去查詢重復(fù)記錄及相關(guān)的性能討論
- SQL分組排序去重復(fù)的小實例
- oracle sql 去重復(fù)記錄不用distinct如何實現(xiàn)
- SQL語句去掉重復(fù)記錄,獲取重復(fù)記錄
- SQL去除重復(fù)記錄(七種)
相關(guān)文章
SQLServer用t-sql命令批量刪除數(shù)據(jù)庫中指定表(游標循環(huán)刪除)
這篇文章主要介紹了SQLServer用t-sql命令批量刪除數(shù)據(jù)庫中指定表的方法,大家參考使用2013-11-11判斷一個表的數(shù)據(jù)不在另一個表中最優(yōu)秀方法
判斷一個表的數(shù)據(jù)不在另一個表中最優(yōu)秀方法2009-11-11sqlserver索引的原理及索引建立的注意事項小結(jié)
本文起點可能會相對高點,首先你的很熟悉索引以及他們的存儲結(jié)構(gòu) 有很多地方你可能覺得有異議,歡迎一起討論2012-07-07sqlserver 中ntext字段的批量替換(updatetext的用法)
在Sql Server 中,ntext/text/image 字段不允許應(yīng)用replace函數(shù)替換內(nèi)容2009-09-09