• Your requirement is not clear.

    What do you mean by "auto generate"? Are you looking for some kind of an identity column in a custom format?

    To ensure you only have unique entries ou could add a UNIQUE constraint to your table. See BOL (BooksOnLine, the SQL Server help system usually installed together with SQL Server), section "ALTER TABLE (Transact-SQL) ".

    Please send me t-sql code.

    Sure. Please send me the money. 😉

    We're here to help you to improve your T-SQL skills, not to do your job for you.

    Give it a try first, see where you get stuck and post back what you have so far.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]