Auto generated Key

  • I do have couple of query's and for them i have to create a key that will auto generate for each record. Primary column has already few values so i can't use Identity.

    Attached .txt documents for the same.

    This is quite urgent, so experts can you help with this?

    Please let me know for more details.

    Thanks a lot in advance

  • Hello,

    Will 'UniqueIdentifier' datatype help you out?

    Cheers

    Vasan

  • Actually this table has already few rows for Primary key

    Let say from 1 to 20,000.

    But i need to insert data from two different tables and new key value will be unique for each newly inserted data.

    So uniqueidentifier will not help.

    Thanks for your help.

  • EasyBoy (11/8/2011)


    Actually this table has already few rows for Primary key

    Let say from 1 to 20,000.

    Could you please clarify? this is kind of confusing - a table has or has not a PK, there is not such a thing as a PK for a few rows.

    EasyBoy (11/8/2011)


    But i need to insert data from two different tables and new key value will be unique for each newly inserted data. So uniqueidentifier will not help.

    I'll suggest to read again about uniqueidentifier , please start here: http://msdn.microsoft.com/en-us/library/ms187942.aspx

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Viewing 4 posts - 1 through 4 (of 4 total)

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