When developers copy a column from one table to another table, the column name and many of the other properties they defined for that column in the original table are copied to the new location. They can copy column properties from a primary key column to a foreign key column if they want to relate the two columns. Related columns must have the same data type (or data types that can be related) and length.When developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to copy primary key columns to foreign key columns, they should follow the next steps:
1. In Object Explorer, right-click the table with primary key columns they want to copy and click Design (Modify in SP1 or earlier). Do the same for the table into which they want to copy the columns as foreign keys.
The tables open in Table Designer.
2. Click the tab for the table with the columns they want to copy.
3. Select the primary key columns that they want to copy.
Primary key columns are indicated by a key symbol in their row selector.
4. From the Edit menu, click Copy.
5. Click the tab for the table into which they want to copy the columns.
6. Select the column they want to follow the inserted columns and from the Edit menu, click Paste.
7. Right-click the foreign key table and click Relationships on the shortcut menu.
The Foreign Key Relationships dialog box opens.
8. Create a relationship between the primary key and foreign key columns.