lundi 29 juin 2015

Change column to foreign key

How do I change an existing column from bit to a foreign key (int)?

For example, column NEW_B was created like this:

ALTER TABLE [dbo].[APPLICATION]
ADD [NEW_B] [bit] NULL
GO

But now I want the NEW_B to reference column ID (int) of table ATTACHMENT (want to keep the name NEW_B, also allow NULLs).

Aucun commentaire:

Enregistrer un commentaire