龍巖易富通網絡科技有限公司

龍巖小程序開發(fā),龍巖分銷系統(tǒng)

mssql如何復制表結構和表數(shù)據(jù)

2015.09.10 | 696閱讀 | 0條評論 | 未命名

-復制結構+數(shù)據(jù)
select *  into 數(shù)據(jù)庫名.dbo.新表名   from  數(shù)據(jù)庫名.dbo.原表名
--只復制結構 
select *  into 數(shù)據(jù)庫名.dbo.新表名   from  數(shù)據(jù)庫名.dbo.原表名 where 1=0

--復制到臨時表
select *  into #temptablename   from  數(shù)據(jù)庫名.dbo.原表名 where 1=0

--后面的where 1=0 只要不成立就行了,管它是1=2,還是1000=1001...

贊 (

發(fā)表評論