列名我有這個表包含這些列:字符串或二進制數據將被截斷=>腳本
CREATE TABLE CARD
(
CARD_IDE INT NOT NULL IDENTITY,
CARD_NAME VARCHAR(50) NOT NULL,
CARD_NUMBER NUMERIC(4) NOT NULL,
CARD_COLOR VARCHAR(10),
CARD_MANA_COST VARCHAR(30),
CARD_MANA_CONVT VARCHAR(3),
CARD_TYPE VARCHAR(50),
CARD_POWER VARCHAR(2),
CARD_TOUGH VARCHAR(2),
CARD_RARTY VARCHAR(1) NOT NULL,
CARD_TEXT_ABILT VARCHAR(800),
CARD_TEXT_FLAVR VARCHAR(800),
CARD_ARTST_NAME VARCHAR(100),
CARD_SET_IDE INT NOT NULL,
CARD_FLAG_FACE INT NOT NULL DEFAULT 0,
CARD_CHILD_IDE INT
);
GO
表本身不存在任何問題的產生。我們將主要數據與腳本一起用於測試目的。然而,截至本週新引入的欄目爲CARD_FLAG_FACE
和CARD_CHILD_IDE
,他們給我提出了問題。
下面是我們推出養活我們的數據腳本:
INSERT INTO CARD (CARD_NUMBER, CARD_NAME, CARD_COLOR, CARD_MANA_COST, CARD_MANA_CONVT, CARD_TYPE, CARD_POWER, CARD_TOUGH, CARD_RARTY, CARD_TEXT_ABILT, CARD_TEXT_FLAVR, CARD_ARTST_NAME, CARD_FLAG_FACE, CARD_CHILD_IDE, CARD_SET_IDE)
SELECT 1, 'Angel of Glory''s Rise', 'White', '5WW', '7', 'Creature - Angel', '4', '6', 'Common', 'Flying When Angel of Glory''s Rise enters the battlefield, exile all Zombies, then return all Human creature cards from your graveyard to the battlefield. ', '"Justice isn''t done until undeath is undone." ', 'James Ryman', 0, null, @CardSetIdForAVR
GO
如果我們運行這個,我得到以下錯誤:
Msg 8152, Level 16, State 14, Line 9
String or binary data would be truncated.
The statement has been terminated.
線9是INSERT
語句的準確線,這讓我感到困惑。現在如果我在剝離兩個新列的同時運行相同的腳本:
INSERT INTO CARD (CARD_NUMBER, CARD_NAME, CARD_COLOR, CARD_MANA_COST, CARD_MANA_CONVT, CARD_TYPE, CARD_POWER, CARD_TOUGH, CARD_RARTY, CARD_TEXT_ABILT, CARD_TEXT_FLAVR, CARD_ARTST_NAME, CARD_SET_IDE)
SELECT 1, 'Angel of Glory''s Rise', 'White', '5WW', '7', 'Creature - Angel', '4', '6', 'Common', 'Flying When Angel of Glory''s Rise enters the battlefield, exile all Zombies, then return all Human creature cards from your graveyard to the battlefield. ', '"Justice isn''t done until undeath is undone." ', 'James Ryman', @CardSetIdForAVR
GO
現在它運行平穩。我不明白爲什麼會發生錯誤,我需要你的幫助。
編輯
按照許多請求(因爲我無法找到錯誤)我已經發布的原代碼。
桌子上是否有觸發器?最可能的原因是 – gbn
什麼是觸發器?我沒有使用sql腳本,所以我不知道它是什麼。 – hsim
但坦率地說,我認爲沒有觸發器,因爲我已經閱讀了大部分腳本,並且我沒有在任何地方看到過這個命令。 – hsim