Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6594895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:52:10+00:00 2026-05-25T17:52:10+00:00

I have an audit table and instead of defining an identity or ticketed column,

  • 0

I have an audit table and instead of defining an identity or ticketed column, I’m considering just pushing in the records of the recorded table (via triggers).

Can a SQL Server 2000 table have no PK, and therefore contain duplicate records?

If yes, does all I have to do consist of CREATING the TABLE without defining any constraint on it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:52:10+00:00Added an answer on May 25, 2026 at 5:52 pm

    Yes a SQL Server 2000 table can have no primary key and contain duplicate records and yes you can simply Create a table without defining any constraint on it. However I would not suggest this.

    Instead, since you are creating an audit table for another table. Lets say for this example you have a Person Table and a Person Audit table that tracks changes in the person Table.

    Create your Audit Table like this

    CREATE TABLE dbo.PersonAuditID
    (
      PersonAuditID int NOT NULL IDENTITY (1, 1),
      PersonId int NOT NULL,
      FirstName nvarchar(50) NOT NULL,
      LastName nvarchar(50) NOT NULL,
      PersonWhoMadeTheChange nvarchar(100) NOT NULL,
      TimeOfChange datetime NOT NULL,
      ChangeAction int NOT NULL,
      /* any other fields here*/
      CONSTRAINT [PK_PersonAudit] PRIMARY KEY NONCLUSTERED 
      (
    [PersonAuditID] ASC
      )
    )  ON [PRIMARY]
    

    This will give you a primary key, and keep records unique to the table. It also provides the ability to track who made the change, when the change was made, and if the change was an insert, update or delete.

    Your triggers would look like the following

    CREATE TRIGGER Insert_PERSON
       ON  PERSON
       AFTER INSERT
    AS 
    BEGIN
        SET NOCOUNT ON;
        INSERT INTO PERSONAUDIT
        (PersonID, 
         FirstName, 
         LastName, 
         PersonWhoMadeTheChange, 
         TimeOfChange, 
         ChangeAction,
         ... other fields here
         SELECT 
           PersonID,
           FirstName,
           LastName,
           User(),
           getDate(),
           1,
           ... other fields here
         FROM INSERTED
    
    END
    
    CREATE TRIGGER Update_PERSON
       ON  PERSON
       AFTER UPDATE
    AS 
    BEGIN
        SET NOCOUNT ON;
        INSERT INTO PERSONAUDIT
        (PersonID, 
         FirstName, 
         LastName, 
         PersonWhoMadeTheChange, 
         TimeOfChange, 
         ChangeAction,
         ... other fields here
         SELECT 
           PersonID,
           FirstName,
           LastName,
           User(),
           getDate(),
           2,
           ... other fields here
         FROM INSERTED
    
    END
    
    CREATE TRIGGER Delete_PERSON
       ON  PERSON
       AFTER DELETE
    AS 
    BEGIN
        SET NOCOUNT ON;
        INSERT INTO PERSONAUDIT
        (PersonID, 
         FirstName, 
         LastName, 
         PersonWhoMadeTheChange, 
         TimeOfChange, 
         ChangeAction,
         ... other fields here
         SELECT 
           PersonID,
           FirstName,
           LastName,
           User(),
           getDate(),
           3,
           ... other fields here
         FROM DELETED
    
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have audit for records in a table. There multiple columns and each records
Is there a way to update a record in an audit table (via triggers)
I have an audit Trail table where I store the records with time taken
I have an audit record table that I am writing to. I am connecting
I have a quick question. I'm have a db an audit Table with a
I have a table called 'Audit' in SQL Server 2005 like this: Name |
We have audit columns set by triggers. For obscure security reasons predating my tenure
I have an audit table in SQL server. It is to record an entry
I have an audit table in my SQL Server 2008 database which contains the
We have an audit table in our database, and on update the old and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.