Im having some troubles with creating a table with SQL that has a composite key. The two fields im trying to have as composite keys are user_id and address_type within the address table. Any help with this would be fanastic.
Thanks in advance
Pete
Printable View
Im having some troubles with creating a table with SQL that has a composite key. The two fields im trying to have as composite keys are user_id and address_type within the address table. Any help with this would be fanastic.
Thanks in advance
Pete
After creating your table add the PK like this:
ALTER TABLE [dbo].[addresstable] ADD
CONSTRAINT [PK_ACCTIONCODE] PRIMARY KEY CLUSTERED
( [user_id ], [address_type ] )