Assigning Column default value as another Column

  • Hi,

    I am using SQL Server 2000. I have a database table as TABLE1. TABLE1 has following structure :

    PRI_KEY INT, IDENTITY(1,1),

    DESC VARCHAR(10),

    REF_KEY INT

    The PRI_KEY is the primary key for the table and is defined as int and IDENTITY(1,1).

    The issue is that I want to assign the default value of REF_KEY to the value of PRI_KEY. So whatever value PRI_KEY gets the REF_KEY should also get the same value as default.

    Can I do this?

    Thanks in advance.

    Ashish

  • Since DEFAULT for column is defined as constant_expression then the only way to do it will be insteadof trigger.

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

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