Special processing for the Identity field in DTS.

xiaoxiao2021-03-06  40

Problem Suit: Using DTS to import a question when there is an Identity field. Table A has a field ID, for the Identity (1, 1) type.

I imported with DTS, if you choose this column, an error (you can't have a replication ID column). If you don't choose, you will report an error (ID can't be empty). Of course, my ID is also primary, but if this property is removed, the DTS can be imported, and the record of this field will be repeated. Workaround: Enable the flag column insertion option, hook. Import along with the sign column.

This option should be disabled. In the last tab "Option" of the DTS task property, there is a "enable Identity Insert" option to remove it. Some other reference methods: DBCC CHECKIDENT (Number, Release) - Execute this INSERT INTO TB2 (In addition to the field of the ID) SELECT (corresponding to the parallel field name) from TB1 Select Identity (int, 1, 1) AS autoid, * into #tmp from Tablename Select Min (AutoID) AS Autoid Into # Tmp2 from #tmp Group by Name, Autoid Select * from #tmp Where Autoid in (Select Autoid from # TMP2)

转载请注明原文地址:https://www.9cbs.com/read-74809.html

New Post(0)