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

SQL Server 中Select into復(fù)制數(shù)據(jù)到新表

數(shù)據(jù)庫(kù) SQL Server
本篇帶給大家在SQL Server中使用 select into 可以創(chuàng)建一張新表的同時(shí)將原有表數(shù)據(jù)追加到新表中的相關(guān)知識(shí)。希望能夠幫助到你!

[[396980]]

 在SQL Server中使用 select into 可以創(chuàng)建一張新表的同時(shí)將原有表數(shù)據(jù)追加到新表中,現(xiàn)在創(chuàng)建一張測(cè)試表,里面存放各城市大學(xué)名稱:

  1. create table [dbo].[school]( 
  2. [id] [bigint] identity(1,1) not null
  3. [name] [varchar](50) not null
  4. [cityid] [bigintnot null
  5. constraint [school_primary] primary key clustered  
  6.  
  7. [id] asc 
  8.  ) 

 為測(cè)試表創(chuàng)建以cityid為索引列的非聚集索引:

  1. create nonclustered index [index_school_cityid] on [dbo].[school] ([cityid] asc

追加數(shù)據(jù)后,查看該表的數(shù)據(jù):

  1. select * from school 

 

現(xiàn)在使用 select into 復(fù)制一張新表school_test:

  1. select * into school_test from school 

查看新表school_test的數(shù)據(jù),和原有表schoo相同:

  1. select * from school_test 

再來(lái)看看新表的結(jié)構(gòu),發(fā)現(xiàn)id的自增屬性被復(fù)制了:

而其他的屬性,如原表的主鍵和索引卻沒有被復(fù)制到新表:

說(shuō)明使用select into 可以復(fù)制原表的數(shù)據(jù)、字段和自增屬性,而主鍵和索引等卻無(wú)法被復(fù)制。

 

責(zé)任編輯:姜華 來(lái)源: 今日頭條
相關(guān)推薦

2010-11-23 14:58:05

MySQL復(fù)制表數(shù)據(jù)

2010-11-11 10:18:59

select into

2010-07-15 17:57:48

SQL Server數(shù)

2010-11-11 11:00:06

sql server遍

2011-01-13 08:47:49

SQL Server數(shù)

2010-09-16 14:13:11

SQL Server系

2011-07-28 18:08:51

SQL Server MySQL

2011-04-02 16:20:21

SQL SERVER 同步復(fù)制

2010-07-09 11:28:12

SQL Server數(shù)

2010-10-21 15:13:20

SQL Server系

2011-04-12 09:07:50

復(fù)制數(shù)據(jù)庫(kù)SQL 2008

2010-10-20 14:56:18

2010-05-13 10:00:10

SQL Server

2011-03-29 13:22:07

SQL Server臨時(shí)表表變量

2010-10-20 14:23:28

SQL Server復(fù)

2010-07-22 16:02:29

2011-08-15 17:55:49

提取MapInfo地圖SQL Server

2010-07-19 11:01:55

SQL Server

2010-09-03 15:27:02

SQLSELECT語(yǔ)句

2010-10-20 14:27:09

SQL Server同
點(diǎn)贊
收藏

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