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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:53:40+00:00 2026-05-11T23:53:40+00:00

I inherited a system that stores default values for some fields in some tables

  • 0

I inherited a system that stores default values for some fields in some tables in the database. These default values are used in the application to prepopulate control values. So, essentially, every field in every table in the database can potentially have a default value. The previous developer decided to store these values in a single table that had a key/value pair combo. The key represented by the source table + field name (as a varchar) and the default value as a varchar field as well. The Business layer would then cast the varchar field to the appropriate data type.

Somehow, I feel this is brittle. Though the application works as expected, there appears to be a flaw in the design.

Any suggestions on how this requirement could have been handled earlier? Is there anything that can be done now to make it more robust?

EDIT: I should have defined what the term “default” meant. This is NOT related to the default value of a field in the table. Instead, it’s a default value that will be used by the application in the front end.

  • 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-11T23:53:40+00:00Added an answer on May 11, 2026 at 11:53 pm

    That schema design is fine. I’ve seen it used in commercial apps and I’ve also used it in a few apps of my own where the users needed to be able to change the defaults or other parameters around fields in the application (limits, allowable characters etc.) or the application allowed the users to add new fields for use in the app.

    Having it in a single table (not separate default tables for each table) protects it from schema changes in the tables it supports. Those schema changes become simple configuration changes in this model.

    The single table makes it easy to encapsulate in a Class to serve as the “defaults” configuration object.

    Some general advice:
    When you inherit a working system and don’t understand why something was designed the way it is – the problem is most likely your understanding, not the system. If it isn’t broken, do not fix it.

    Specific advice on the only improvements I would recommend (if they become necessary):
    You can use the new SQLVARIANT field for the value rather than a varchar – it can hold any of the regular data types – you will need to add support for casting them to the correct data type when using the value though.

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

Sidebar

Ask A Question

Stats

  • Questions 151k
  • Answers 151k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Once you have the tag in local repository you can… May 12, 2026 at 9:56 am
  • Editorial Team
    Editorial Team added an answer Basically you can't do that. At least crossbrowser. But if… May 12, 2026 at 9:56 am
  • Editorial Team
    Editorial Team added an answer The usual pattern here is similar to sorting by an… May 12, 2026 at 9:56 am

Related Questions

I have inherited a project that uses the following pattern for passing parameters from
I'm looking for best practices for establishing connections between Oracle 8 and Visual Studio
I've inherited a web app that I've just discovered stores over 300,000 usernames/passwords in
I've inherited a legacy system with lots (160+) of stored procedures. I'm looking for

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.