create a unique number with date (year)!?

  • Hi,

    i work with sql server 2005 and i 'm a beginner !

    i have a table as this :

    demandeId => int identity auto number

    numeroDemande => int

    and so on..

    For the field numeroDemande, i'd like it would be the demandId with the year

    an exemple

    200911 => 2009 the year => 11 it the demandeId

    201016 => 2010 year and 16 the demandeId

    this field must be filed when a record it's inserted and i think it will be do with a trigger !?

    But as a beginner, i don't know how i can do !?

    have you got any idea ?

    Thanks for your time

    Christophe

  • Simple Solution would be adding another column as Year and add 2009 / 2010 in that column and Define A composite Primary Key on Year Column and Demandid column.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

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

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