January 14, 2004 at 6:20 am
Hello,
I've recently performed the following command successfully on SQL SERVER 8:
truncate table T1
SET IDENTITY_INSERT T1 ON
insert T1
(NischID, ProdName, CustID, NischName, MonthDel, SuppID)
select * from T2
where T1 and T2 have the same structure. In the help file I read the following on the INSERT-command:
"column_list and VALUES list must be used when inserting explicit values into an identity column, and the SET IDENTITY_INSERT option must be ON for the table."
In my command I didn't use any VALUES list but it still worked even though the NischID is a primary key, not null.
My question is. Is there an error in the documentation or have I interpreted the documentation wrong?
January 14, 2004 at 7:46 am
Can you psot result of sp_columns T2?
January 14, 2004 at 7:55 am
You mean the data from T2? Sorry, that information is classified. But it doesn't really mather, does it?
I did this instruction to restore a table. T1 had been deleted and T2 was a backup of that table.
January 14, 2004 at 8:02 am
Try to run it. It just returns table schema but no data.
January 14, 2004 at 8:06 am
I did run it and it works fine. I've restored my table and I'm happy.
But I do want to know WHY did it work in the way I wrote it? According to the documentatition (check the documentation of the insert command) this should generate an error.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply