国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
sql server中數(shù)據(jù)庫之間復(fù)制表
數(shù)據(jù)庫表間數(shù)據(jù)復(fù)制      在利用數(shù)據(jù)庫開發(fā)時(shí),常常會(huì)將一些表之間的數(shù)據(jù)互相導(dǎo)入。當(dāng)然可以編寫程序?qū)崿F(xiàn),但是,程序常常需要開發(fā)環(huán)境,不方便。最方便是利用sql語言直接導(dǎo)入。既方便而修改也簡單。以下就是導(dǎo)入的方法。1。表結(jié)構(gòu)相同的表,且在同一數(shù)據(jù)庫(如,table1,table2)Sql :insert into table1 select * from table2 (完全復(fù)制)insert into table1 select distinct * from table2(不復(fù)制重復(fù)紀(jì)錄)insert into table1 select top 5 * from table2 (前五條紀(jì)錄)2。   不在同一數(shù)據(jù)庫中(如,db1 table1,db2 table2)sql:    insert into db1..table1 select * from db2..table2 (完全復(fù)制)insert into db1..table1 select distinct * from db2table2(不復(fù)制重復(fù)紀(jì)錄)insert into tdb1..able1 select top 5 * from   db2table2 (前五條紀(jì)錄)3.      表結(jié)構(gòu)不同的表或復(fù)制部分紀(jì)錄(如,dn_user,dn_user2)a.    建一個(gè)新表[DN_UserTemp](在老表dn_user上增加一列)CREATE TABLE [DN_UserTemp] ( [Num] [numeric](18, 0) IDENTITY (1, 1) NOT NULL)[Id] [idtype] NOT NULL ,[Name] [fntype] NOT NULL ,[Descript] [dstype] NULL ,[LogonNm] [idtype] NOT NULL ,[Password] [idtype] NULL ,[Gender] [char] (1) NULL ,[Quited] [booltype] NOT NULL,[OffDuty] [booltype] NOT NULL ,[Stopped] [booltype] NOT NULL,[OSBind] [booltype] NOT NULL,[Domain] [idtype] NULL ,[EMail] [fntype] NULL ,[UnitId] [idtype] NULL ,[BranchId] [idtype] NULL ,[DutyId] [idtype] NULL ,[LevelId] [idtype] NULL ,[ClassId] [idtype] NULL ,[TypeId] [idtype] NULL ,[IP] [varchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,[ExpireDT] [datetime] NULL ,[Sort] [int] NOT NULL ,[AllowDel] [booltype] NOT NULL,[UnitChief] [booltype] NOT NULL,[BranchChief] [booltype] NOT NULL ,[UnitDeputy] [booltype] NOT NULL ,[BranchDeputy] [booltype] NOT NULL ,[Num] [numeric](18, 0) IDENTITY (1, 1) NOT NULL) ON [PRIMARY]b. 將dn_uer2的數(shù)據(jù)拷入dn_usertempsql:insert into dn_usertemp select * from dn_user2c.將dn_usertemp 拷入dn_usersql:declare @i intdeclare @j intdeclare @Name fntypeset @i=1select @j=count(*) from dn_usertempwhile @i<@j 1beginselect @Name=Name from dn_usertemp where Num=@iprint @Nameinsert into dn_user (Name) values (@Name) where Num=@iselect @i=@i 1end---------------------------creat到--然后把數(shù)據(jù)庫名改成想復(fù)制到的那個(gè)庫的名稱 
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
白話MyCat——MyCat部署運(yùn)行(Linux環(huán)境)與使用步驟詳解
sql語句大全(詳細(xì))
mysql常識(shí)和基本操作
如何在sql server中設(shè)置兩個(gè)主鍵
SQL詳解
MySql常用命令
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服