異常為"當IDENTITY_INSERT設置為OFF時" 解決辦法


當 IDENTITY_INSERT 設置為 OFF 時,不能向表"A" 中的標識列插入顯示值。

一般來說是自增ID造成的。

因此可以在數據庫insert語句前加上 SET identity_insert tiexie_config on

                          查詢語句之后加上  SET identity_insert tiexie_config off

即可。

 

例如:

SET identity_insert tiexie_config ON
INSERT INTO [GMIS2000S].[dbo].[tiexie_config] (
    [Id],
    [Info_Car_Id],
    [Tiexie_Num],
    [Tiexie_RFID],
    [Modify_User_Id],
    [Create_User_Id],
    [Create_Date],
    [Modify_Date],
    [Sts]
)
VALUES
    (
        '90',
        '153',
        'HG-004',
        '17194004',
        NULL,
        '368',
        '2017-08-25 16:30:02.557',
        NULL,
        'Y'
    );
 SET identity_insert tiexie_config off

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM