How to generating Unique keys on the basis of multiple column in ssis

  • Hi,

    I have one table in SQL where data coming from source oracle.

    Itmkey is not there in source and it have identity constraint

    CREATE TABLE [dbo].[Itm](

    [ItmKey] [int] IDENTITY(1,1) NOT NULL,

    [CustId] [int] NOT NULL,

    [CustNm] [nvarchar](100) NOT NULL,

    [PartNm] [nvarchar](100) NOT NULL,

    [ItmId] [nvarchar](100) NOT NULL,

    [ItmTyp] [nvarchar](50) NOT NULL

    )

    GO

    Below are the index created on the table

    CREATE UNIQUE NONCLUSTERED INDEX [XAK1Itm] ON [dbo].[Itm]

    (

    [CustId] ASC,

    [PartNm] ASC,

    [ItmId] ASC,

    [ItmTyp] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)

    GO

    my requirement is that I have to truncate and load every time when my package run.

    kindly find the attachment of above table data. I don't understand how ITMKey are generating uniquely.

    kindly help me to understand the above concern

  • Hi,

    I'm not sure I understand your question. Have a read of this: http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/[/url] and see if that answers your concern. If not, reply with any more information/questions.

    Thanks,

    Simon



    MCSE: Data Platform
    MCSE: Business Intelligence
    Follow me on Twitter: @WazzTheBadger
    LinkedIn Profile: Simon Osborne

  • Hi

    As s_osborne2 mentioned above, TRUNCATE TABLE removes all rows from a table, if the table contains an identity column, the counter for that column is reset to the seed value defined for the column. To retain the identity counter, use DELETE instead.

    Regards

    Mike

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply