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

  • Home
  • SEARCH
  • 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 713871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:00:37+00:00 2026-05-14T05:00:37+00:00

I thought I’d be flexible this time around and let the users decide what

  • 0

I thought I’d be flexible this time around and let the users decide what contact information the wish to store in their database. In theory it would look as a single row containing, for instance; name, address, zipcode, Category X, Listitems A.

Example
FieldType table defining the datatypes available to a user:

FieldTypeID, FieldTypeName, TableName
1,"Integer","tblContactInt"
2,"String50","tblContactStr50"
...

A user the define his fields in the FieldDefinition table:

FieldDefinitionID, FieldTypeID, FieldDefinitionName
11,2,"Name"
12,2,"Address"
13,1,"Age"

Finally we store the actual contact data in separate tables depending on its datatype.
Master table, only contains the ContactID

tblContact:

ContactID
21
22

tblContactStr50:

ContactStr50ID,ContactID,FieldDefinitionID,ContactStr50Value
31,21,11,"Person A"
32,21,12,"Address of person A"
33,22,11,"Person B"

tblContactInt:

ContactIntID,ContactID,FieldDefinitionID,ContactIntValue
41,22,13,27

Question: Is it possible to return the content of these tables in two rows like this:

ContactID,Name,Address,Age
21,"Person A","Address of person A",NULL
22,"Person B",NULL,27

I have looked into using the COALESCE and Temp tables, wondering if this is at all possible. Even if it is: maybe I’m only adding complexity whilst sacrificing performance for benefit in datastorage and user definition option.

What do you think?

  • 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-14T05:00:37+00:00Added an answer on May 14, 2026 at 5:00 am

    I don’t think this is a good way to go because:

    • A simple insert of 1 record for a contact suddenly becomes n inserts. e.g. if you store varchar, nvarchar, int, bit, datetime, smallint and tinyint data for a contact, that’s 7 inserts in datatype specific tables, +1 for the main header record
    • Likewise, a query will automatically reference 7 tables, with 6 JOINs involved just to get the full details

    I personally think it’s better to go for a less “generic” approach. Keep it simple.

    Update:
    The question is, do you really need a flexible solution like this? For contact data, you always expect to be able to store at least a core set of fields (address line 1-n, first name, surname etc). If you need a way for the user to store custom/user definable data on top of that standard data set, that’s a common requirement. Various options include:

    • XML column in your main Contacts table to store all the user defined data
    • 1 extra table containing key-value pair data a bit like you originally talked about but to much lesser degree! This would contain the key of the contact, the custom data item name and the value.

    These have been discussed before here on SO so would be worth digging around for that question. Can’t seem to find the question I’m remembering after a quick look though!

    Found some that discuss the pros/cons of the key-value approach, to save repeating:
    Key value pairs in relational database
    Key/Value pairs in a database table

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

Sidebar

Related Questions

Thought is was time to bring this to the Stack. We have IIS 7.5
I thought I heard that py2exe was able to do this, but I never
I thought I had seen a bug report about this on the jQuery site,
I thought I'd offer this softball to whomever would like to hit it out
I thought this was asked before, but 15 minutes of searching on Google and
Thought I understood how classes work, then I tried this code: class user {
I thought this would be really easy but I can't find a simple solution,
I thought I was getting the hang of this, then I ran into a
Thought this might work: ${TM_FILENAME/(.+?)(\.[^.]*$|$)/} But it's giving me this error: Error Parsing Snippet
I thought this would be a pretty common question to look for in Google

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.