自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

SQL Server數(shù)據(jù)庫(kù)中不同數(shù)據(jù)庫(kù)相同表結(jié)構(gòu)的數(shù)據(jù)導(dǎo)入

數(shù)據(jù)庫(kù) SQL Server
本文我們主要介紹了在SQL Server數(shù)據(jù)庫(kù)的不同數(shù)據(jù)庫(kù)之間實(shí)現(xiàn)相同表結(jié)構(gòu)的數(shù)據(jù)導(dǎo)入的方法,并給出了全部的實(shí)現(xiàn)代碼,希望能夠?qū)δ兴鶐椭?/div>

SQL Server數(shù)據(jù)庫(kù)中,數(shù)據(jù)庫(kù)不同,但表結(jié)構(gòu)相同數(shù)據(jù)可以相互導(dǎo)入嗎?答案是肯定的。本文我們就來(lái)介紹這一過(guò)程,接下來(lái)就讓我們來(lái)一起了解一下吧。

在SQL Server數(shù)據(jù)庫(kù)下,新建兩個(gè)不同的數(shù)據(jù)庫(kù)名字,然后在數(shù)據(jù)庫(kù)下創(chuàng)建兩個(gè)相同結(jié)構(gòu)的表(建議使用SQL語(yǔ)句),比如:

在soutest數(shù)據(jù)庫(kù)下寫(xiě)入以下語(yǔ)句:

 

  1. create table Employee1  
  2.  
  3. (  
  4.  
  5. EmployeeID int primary key ,  
  6.  
  7. EmployeeName varchar(20) not null,  
  8.  
  9. EmployeeAge smallint not null,  
  10.  
  11. EmployeeSex char(2) default '女',  
  12.  
  13. EmployeeCellPhone int not null,  
  14.  
  15. EmployeeAddress nvarchar(50),  
  16.  
  17. EmployeeComments nvarchar(1000)   
  18.  

 

然后往這個(gè)表中插入數(shù)據(jù)(注:如果在源表中設(shè)置了標(biāo)識(shí)符的,請(qǐng)?jiān)谙旅嬲Z(yǔ)句前加入set identity_insert on, ***加入set identity_insert off):

 

  1. insert into Employee(EmployeeID,EmployeeName,EmployeeAge,EmployeeCellPhone,EmployeeAddress,EmployeeComments)   
  2.  
  3. values(2,'xd',12,123455,'beijing', 'handsome man')  
  4.  
  5. insert into Employee(EmployeeID,EmployeeName,EmployeeAge,EmployeeCellPhone,EmployeeAddress,EmployeeComments)   
  6.  
  7. values(3,'xwxe',12,123455,'shanghai', ' a good boy') 

 

我們將在test下創(chuàng)建表的語(yǔ)句放在另一個(gè)數(shù)據(jù)庫(kù)destest下執(zhí)行,這時(shí),我們建立了一個(gè)表。再在這個(gè)數(shù)據(jù)庫(kù)下執(zhí)行以下語(yǔ)句:

 

  1. insert destest.dbo.Employee (EmployeeID,EmployeeName,EmployeeAge,EmployeeSex,EmployeeCellPhone,EmployeeAddress,EmployeeComments)   
  2.  
  3. select EmployeeID,EmployeeName,EmployeeAge,EmployeeSex,EmployeeCellPhone,EmployeeAddress,EmployeeComments  
  4.  
  5. from soutest.dbo.Employee 

 

至此,工作全部結(jié)束。

關(guān)于SQL Server數(shù)據(jù)庫(kù)中兩個(gè)不同數(shù)據(jù)庫(kù)但相同表結(jié)構(gòu)的數(shù)據(jù)導(dǎo)入的知識(shí)就介紹這么多了,希望本次的介紹能夠?qū)δ兴鶐椭?/p>

【編輯推薦】

  1. 沒(méi)有SQL Server數(shù)據(jù)庫(kù)時(shí)怎樣打開(kāi).MDF文件?
  2. SQLServer 2008 R2數(shù)據(jù)庫(kù)SSAS建模及擴(kuò)展能力詳解
  3. 一個(gè)SQL Server數(shù)據(jù)庫(kù)刪除數(shù)據(jù)集中重復(fù)數(shù)據(jù)的例子
  4. 如何用觸發(fā)器實(shí)現(xiàn)記錄數(shù)據(jù)庫(kù)表和記錄更改日志的操作
  5. 通過(guò)引進(jìn)SQL Server 2000驅(qū)動(dòng)的jar包連接SQL服務(wù)器
責(zé)任編輯:趙鵬 來(lái)源: 博客園
相關(guān)推薦

2017-05-25 10:23:13

數(shù)據(jù)a表b表

2010-05-24 13:14:19

創(chuàng)建MySQL

2011-03-11 13:26:23

SQL Server數(shù)導(dǎo)入數(shù)據(jù)

2010-07-15 17:28:50

SQL Server

2010-11-09 17:19:49

SQL Server導(dǎo)

2021-05-17 06:57:34

SQLServer數(shù)據(jù)庫(kù)

2010-07-09 11:28:12

SQL Server數(shù)

2010-06-30 16:48:19

SQL Server數(shù)

2010-10-22 11:22:33

SQL Server數(shù)

2010-07-08 11:05:14

SQL Server數(shù)

2011-09-01 14:00:11

SQL Server 存儲(chǔ)過(guò)程顯示表結(jié)構(gòu)

2009-04-30 09:28:05

SynonymOpenquerySQL Server

2010-06-17 13:34:47

SQL Server數(shù)

2010-07-21 14:17:36

SQL Server數(shù)

2011-08-15 16:58:34

SQL Server遠(yuǎn)程查詢批量導(dǎo)入數(shù)據(jù)

2010-10-26 11:04:48

oracle數(shù)據(jù)導(dǎo)入

2010-07-21 14:11:36

SQL Server

2010-07-06 14:40:15

解決SQL Serve

2011-05-13 09:42:21

2011-03-24 09:45:34

SQL Server數(shù)恢復(fù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)