Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
5 replies
Subscribers
7 subscribers
Views
4434 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
how to make 2 columns in DB as primary key
Priyanka
over 7 years ago
how to make 2 columns in DB as primary key .
There is a table with columns , fundid, business effective month, profit, loss and other fields.
I have made fundid as primary key. But I should make fundid and business effective month , both together as primary key . How to do that in CDT ?
OriginalPostID-249808
Discussion posts and replies are publicly visible
0
aloks0189
Certified Lead Developer
over 7 years ago
@priyankav Did you try repeating @Id Annotation for both
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Venu
over 7 years ago
@Priyanka,
You can create additional column to save combination values of fundid and business effective month like FUN001_Jan, Make that additional column as PK in your CDT.
From DB side Additional Column should be Unique Key, PK is (fundid and business effective month).
https://forum.appian.com/suite/help/16.3/Database_Schema_Best_Practices.html#composite-keys
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Priyanka
over 7 years ago
I tried @ Id for both columns and able to see the primary key image on both of them . Hope that is the combined primary key
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aloks0189
Certified Lead Developer
over 7 years ago
@priyankav Yes you are right, we can define more than one column as Primary using @Id, and Combined Primary key is a combination of two or more columns in a table that can be used to uniquely identify each row in the table
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sparshs
over 7 years ago
I agree with venusaikumarc , you make changes in your database to put up a additional column in your table which will have data from both the columns and that you can define as your primary key. I think that should work.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel