偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

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

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

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

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

在soutest數(shù)據(jù)庫下寫入以下語句:

 

  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.  

 

然后往這個表中插入數(shù)據(jù)(注:如果在源表中設置了標識符的,請在下面語句前加入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)建表的語句放在另一個數(shù)據(jù)庫destest下執(zhí)行,這時,我們建立了一個表。再在這個數(shù)據(jù)庫下執(zhí)行以下語句:

 

  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é)束。

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

【編輯推薦】

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

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ù)導入數(shù)據(jù)

2010-07-15 17:28:50

SQL Server

2010-11-09 17:19:49

SQL Server導

2021-05-17 06:57:34

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

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ù)

2010-06-17 13:34:47

SQL Server數(shù)

2009-04-30 09:28:05

SynonymOpenquerySQL Server

2011-09-01 14:00:11

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

2010-10-26 11:04:48

oracle數(shù)據(jù)導入

2011-08-15 16:58:34

SQL Server遠程查詢批量導入數(shù)據(jù)

2010-07-21 14:17:36

SQL Server數(shù)

2010-07-21 14:11:36

SQL Server

2010-07-06 14:40:15

解決SQL Serve

2011-03-24 09:07:11

SQL Server數(shù)備份

2011-03-24 09:24:08

SQL Server數(shù)還原
點贊
收藏

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