-
Composite primary keys
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 ] )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|