久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

列名或編號(hào)...與創(chuàng)建腳本創(chuàng)建的表中的表定義不

column name or number ... not match table definition in table created by create script.Error displayed while inserting rows from one table to another(列名或編號(hào)...與創(chuàng)建腳本創(chuàng)建的表中的表定義不匹配.將行從一個(gè)表插入
本文介紹了列名或編號(hào)...與創(chuàng)建腳本創(chuàng)建的表中的表定義不匹配.將行從一個(gè)表插入到另一個(gè)表時(shí)顯示錯(cuò)誤的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我在不同的服務(wù)器實(shí)例中有兩個(gè)相同的表.一臺(tái)服務(wù)器用于生產(chǎn),另一臺(tái)用于測(cè)試.使用 SQL management studio 創(chuàng)建的腳本創(chuàng)建的測(cè)試表(右鍵單擊表 --> 腳本表為 --> 創(chuàng)建).要移動(dòng)測(cè)試數(shù)據(jù),我使用鏈接服務(wù)器和以下代碼:

set identity_insert ...在插入到<Server>.<DB>.<schema>.<TestTb>從<Server>.<DB>.<schema>.<ProdTB>中選擇前100個(gè)*set identity_insert ...離開

以上適用于我創(chuàng)建的幾個(gè)表.在最后一個(gè)中,我收到列名或提供的值的數(shù)量與創(chuàng)建腳本創(chuàng)建的表中的表定義不匹配"錯(cuò)誤.我檢查了列排序規(guī)則,一切正常.>

我唯一的區(qū)別是我沒有創(chuàng)建在生產(chǎn)環(huán)境中找到的所有索引,但我不認(rèn)為這會(huì)導(dǎo)致錯(cuò)誤.

我正在使用 Sql server 2008.

解決方案

始終 在 insert 語句中指定列列表,并且在 insert...select 中必須始終指定兩次 - 都在insert 子句和 select 子句.

此外,如果您使用 set identity_insert on 而沒有在 insert 子句中明確指定列列表,SQL Server 將引發(fā)錯(cuò)誤,因此即使您確實(shí)獲得了所有列順序正確,在這種情況下您仍然會(huì)收到錯(cuò)誤.

有關(guān)更多信息,請(qǐng)閱讀 Aaron Bertrand 的 要戒掉的壞習(xí)慣:沒有列列表的 SELECT 或 INSERT,Shnugo 在他的評(píng)論中鏈接到.

I have two identical tables in different server instances. One server is production and the other one is for testing. The testing tables where created by using scripts created by SQL management studio (Right click on table -->script table as --> Create). To move test data i am using a linked server and the following code :

set identity_insert <Server>.<DB>.<schema>.<SomeID> ON
insert into <Server>.<DB>.<schema>.<TestTb>
select top 100 * from <Server>.<DB>.<schema>.<ProdTB>
set identity_insert <Server>.<DB>.<schema>.<SomeID> OFF

The above worked for a couple of the tables i created. In the last one, i get the "column name or number of supplied values does not match table definition in table created by create script" error.i have checked the Columns collation and everything is ok.

The only difference i have is that i haven't created all the indexes found in the Production env, but i don't really think this causes the error.

I' m working on Sql server 2008.

解決方案

Always specify the columns list in insert statements, and in insert...select you must always specify it twice - both in the insert clause and in the select clause.

Also, SQL Server will raise an error if you use set identity_insert on without explicitly specifying the columns list in the insert clause, so even if you did get all the columns in the correct order, you would still get an error in this case.

For more information, read Aaron Bertrand's Bad habits to kick: SELECT or INSERT without a column list which Shnugo linked to in his comment.

這篇關(guān)于列名或編號(hào)...與創(chuàng)建腳本創(chuàng)建的表中的表定義不匹配.將行從一個(gè)表插入到另一個(gè)表時(shí)顯示錯(cuò)誤的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Modify Existing decimal places info(修改現(xiàn)有小數(shù)位信息)
The correlation name #39;CONVERT#39; is specified multiple times(多次指定相關(guān)名稱“CONVERT)
T-SQL left join not returning null columns(T-SQL 左連接不返回空列)
remove duplicates from comma or pipeline operator string(從逗號(hào)或管道運(yùn)算符字符串中刪除重復(fù)項(xiàng))
Change an iterative query to a relational set-based query(將迭代查詢更改為基于關(guān)系集的查詢)
concatenate a zero onto sql server select value shows 4 digits still and not 5(將零連接到 sql server 選擇值仍然顯示 4 位而不是 5)
主站蜘蛛池模板: 99久久久久久久 | 日韩欧美国产精品一区二区三区 | 狠狠亚洲 | 国产黄色小视频在线观看 | 亚洲欧美中文日韩在线v日本 | 欧洲精品一区 | 日韩精品一区二区三区久久 | 久久丝袜 | 久久久久久电影 | 欧美高清视频一区 | 中文字幕乱码一区二区三区 | 亚洲免费成人 | 三级免费av | 久久综合婷婷 | 国产欧美精品区一区二区三区 | 亚洲精品一区中文字幕乱码 | 亚洲区在线 | www国产亚洲精品 | www国产精| 久色视频在线 | 欧美一区二区三区四区五区无卡码 | 亚洲日本一区二区三区四区 | 亚洲va欧美va天堂v国产综合 | 久久久久亚洲精品国产 | 在线观看视频一区 | 日韩精品视频在线 | 精品国产青草久久久久福利 | 欧美精品电影一区 | 亚洲国产黄色av | 精品久久久久久久久久久下田 | 国产亚洲精品久久久久动 | 欧美福利 | 伊人网在线综合 | 在线观看欧美日韩视频 | 欧美日韩一区精品 | 亚洲欧美综合网 | 国产三级国产精品 | 在线国产视频 | 拍真实国产伦偷精品 | 91精品国产综合久久久动漫日韩 | 成人国产免费视频 |