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 429217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:45:12+00:00 2026-05-12T19:45:12+00:00

Part of my table design is to include a IsDeleted BIT column that is

  • 0

Part of my table design is to include a IsDeleted BIT column that is set to 1 whenever a user deletes a record. Therefore all SELECTS are inevitable accompanied by a WHERE IsDeleted = 0 condition.

I read in a previous question (I cannot for the love of God re-find that post and reference it) that this might not be the best design and an ‘Audit Trail’ table might be better.

How are you guys dealing with this problem?

Update
I’m on SQL Server. Solutions for other DB’s are welcome albeit not as useful for me but maybe for other people.

Update2
Just to encapsulate what everyone said so far. There seems to be basically 3 ways to deal with this.

  1. Leave it as it is
  2. Create an audit table to keep track of all the changes
  3. Use of views with WHERE IsDeleted = 0
  • 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-12T19:45:12+00:00Added an answer on May 12, 2026 at 7:45 pm

    If you have to have this kind of Deleted Bit column, then you really should consider setting up some VIEWs with the WHERE clause in it, and use those rather than the underlying tables. Much less error prone.

    For example, if you have this view:

    CREATE VIEW [Current Product List] AS
    SELECT ProductID,ProductName
    FROM Products
    WHERE Discontinued=No
    

    Then someone who wants to see current products can simply write:

    SELECT * FROM [Current Product List]
    

    This is much less error prone than writing:

    SELECT ProductID,ProductName
    FROM Products
    WHERE Discontinued=No
    

    As you say, people will forget that WHERE clause, and get confusing and incorrect results.

    P.S. the example SQL comes from Microsoft’s Northwind database. Normally I would recommend NOT using spaces in column and table names.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a temporary table that contains a part category and the associated part
I have a Datetime column called CreatedOn in a table. CreatedOn is also part
I've been asked (as part of homework) to design a Java program that does
In my sql server table, I want to add a computed column that is
I am trying to build / design a table that will serve purpose to
I am inserting part of a large table to a new MyISAM table. I
I have a large table with a multi-part index. I need to run several
Before anyone suggests scrapping the table tags altogether, I'm just modifying this part of
Say I have a table name auto_parts with these fields. id, part, price, timestamp
I need to split an amount into multiple part and insert into an table

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.