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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:45:05+00:00 2026-05-23T02:45:05+00:00

I currently have two joined tables in a SQL Server database, one with news

  • 0

I currently have two joined tables in a SQL Server database, one with news items (newsTab) and a table (usrCom) which captures multiple user comments for each article.

I want to add another information table (infoTab) which will also allow users to comment but I wish to use the existing comments table (usrCom) to store these.

How do I go about creating a linking/bridge table which generates a unique ID so I know which table (newsTab/infoTab) the comments belong to.

NB: I’ve edited the message to hopefully make it a bit clearer

First Table (newsTab)

NewsId    NewsContent
---------------------
1         blah blah
2         and so on

Second Table (infoTab)

infoId    InfoContent    
---------------------
1         some info
2         more stuff

Comments Table (as is currently)

commentId    linksTo   Comment
------------------------------
1            1         user input
2            1         random rant

‘linksTo’ is a foriegn key to the items in the first table, so I cannot just add a type column and I would get conflicts on the foreign key column if a row did not exist in the new table with the same ID. So hence the need for a new generated foreign key based upon the table and Id that was being commented on.

  • 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-23T02:45:06+00:00Added an answer on May 23, 2026 at 2:45 am

    Why not just a “type” column to the usrCom

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

Sidebar

Related Questions

I currently have two text boxes which accept any number. I have a text
Currently I have two MediaWikis, one a slightly older version than the other. I
Excuse the long question! We have two database tables, e.g. Car and Wheel. They
I currently have two UIViews: one of a red background and the other blue.
I currently have to two links, two arrows one pointing up and the other
I currently have quite a messy query, which joins data from multiple tables involving
All, I currently have two projects that are under SourceSafe that I am unable
I currently have an asp.net website hosted on two web servers that sit behind
I have an Auction model with several attributes, two of which are current_auction:boolean and
I currently have an MS Access application that connects to a PostgreSQL database via

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.