Automatically load a ''year'' field with current year

  • Hi. I have a table that the developer wants to have the 'year' field loaded automatically with the 4 digit current year. is there a way to do this when setting up the table using the default value option?  

    Thanks,

    Juanita

  • What is the datatype of the year field? if it is either int / smallint then you can default it like this

    default datepart(yy,getdate())

    Thanks and have a nice day!!!


    Lucky

  • Thanks !!! that worked perfectly!!!

    Juanita

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

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