Setting attribute value to another value in the same table, RRS feed

  • Question

  • I need to create a table in SQL Server 2008 and I need to set one of the attribute values to be equal to the primary key value set?? I am using the following code to create the table, but I am not sure if I am setting the JTKey attribute to be equal to the Employee_ID attribute correctly, I would very much appreciate any advice offered!!

    Create Table Employee
    Employee_ID int identify not null,
    FName varchar(50) not null,
    LName varchar(50) not null,
    Address varchar(50) not null,
    City varchar(20) not null,
    State varchar(20) not null,
    ACode int not null,
    Telephone int not null,
    Age int not null,
    Hire date/time not null,
    Class varchar(50) not null,
    Salary currency not null,
    JTKey int = Employee_ID,
    constraint pk_Employee_ID primary key(Employee_ID)

    Please tell me how I can set JTKEy to Employee_ID....

    Sunday, September 9, 2012 6:06 PM


All replies