因故一些資料的轉換,資料在資料表之間倒來倒去,
但希望插入舊有的IDENTITY值於IDENTITY欄位中...
因而研究了一下 「SET IDENTITY_INSERT」這個指令
確實能將小於目前的IDENTITY NO 加入表格中,符合需求!
但若「想在IDENTITY欄位插入自定數值」,則沒有辦法嘍!
允許將明確的值插入資料表的識別欄位中
如果輸入的值大於資料表目前的識別值,SQL Server 會自動利用新插入的值來作為目前的識別值。
筆記工作上的各種心得,以期獲得的知識與經驗,能有效的分門別類,當有需要時,腦袋瓜子,不再翻箱倒櫃,尋找失落的連結!
允許將明確的值插入資料表的識別欄位中
如果輸入的值大於資料表目前的識別值,SQL Server 會自動利用新插入的值來作為目前的識別值。
Something I stumbled across trying to return a *.csv file to Excel 2000: If the very first text in the file is "ID", Excel will ignore the file extension and attempt to read the file as a SYLK (Symbolic Link) file format.
Just wanted to share this hidden tidbit, in the off-chance that it may save somebody else pain.
-- Rob Storrs, February 15, 2001