I have a table that I'm trying to have the Primary Key (RegistrationID) and secondary field (RegistrationID2) both auto create a random unique identifier when a record is comitted.
Can I set this column to "Identity" even though it is not the Primary Key?
I'm getting an error " Cannot inser the value NULL into column 'RegistrationID2'; column does not allow nulls.
CREATE TABLE [dbo].[OrientationRegistration](
[RegistrationID] [int] IDENTITY(1,1) NOT NULL,
[RegistrationID2] [uniqueidentifier] NOT NULL,
[SubmitDate] [datetime] NULL,
[PreferredName] [varchar](128) NULL,
[BirthDate] [varchar](16) NULL,
CONSTRAINT [UQ__Orientat__C85A786F2692810C] UNIQUE NONCLUSTERED
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]