This project is read-only.

Multiple Primary Key Support

Aug 14, 2012 at 10:13 PM

Are there any plans on releasing a version to support multiple primary keys? This would be super useful...



Aug 15, 2012 at 12:31 AM

Composite primary keys is the most voted item:

I expect a big issue is design of the audit table because of the difficulty of accommodating the variety of composite keys possible.

Oct 11, 2013 at 4:36 PM
Would it be possible to implement a multiple primary key support simply by changing then PrimaryKey column to varchar(200) and then when adding a multiple primary key you just comma separate the value added in the PrimayKey column. Eg 1,5,2
Oct 14, 2013 at 3:10 AM

That would work, it just makes joining to the actual table difficult

Oct 14, 2013 at 8:21 AM
I have made some updates to the scripts, how do I share my updates?

More testing is probably also required.

- Updated column [PrimaryKey] in Audit table to varchar(100), just in case...
- Remove Cluster on column [Id] and created a clustred index on audit on columns [TableName] ASC,   [PrimaryKey] ASC, [AuditDate] DESC
- Updated pAutoAudit and pAutoAuditAll
Added funtionality:
- Support primary key on multiple columns   
- Logg if a primary key changes (This function could/should be improved)
- Filter system tables when AutoAuditAll (Don't cover all systemtables)
Known issus:
-I havn't uppdated view or function
Oct 31, 2013 at 5:43 PM
The latest release of AutoAudit 3.20e handles composite primary keys of up to 5 columns.
The maximum size of each column is 36 characters. Each key column of the composite PK is stored in its own column in the AuditHeader table in columns PrimaryKey, PrimaryKey2, PrimaryKey3, PrimaryKey4 and PrimaryKey5.
Marked as answer by JohnSigouin on 10/31/2013 at 9:44 AM