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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:15:33+00:00 2026-05-28T00:15:33+00:00

I’m using SQL Server 2008, I’m importing the data using the Import Wizard. I

  • 0

I’m using SQL Server 2008, I’m importing the data using the Import Wizard.

I have data from an excel file like the following…

SessionID       Email     SubmitTime      Question1     Question2    Question3 
----------      -----     -----------     ---------     ---------    ----------
54535212        a@b.com   12/21/2011      Yes           No           Yes
54532342        c@d.com   12/22/2011      Yes           Yes          Yes
54535288        e@f.com   12/23/2011      No            No           Yes
54532399        g@h.com   12/24/2011      No            Yes          Yes

Now I want to store it in my database so I can easily access the data. I’m thinking I should make a Users Table, Questions Table, Answers Table, Submitted Table. For my purposes the Submitted Table can become a column for the User’s Table.

User
`Email`
`Submitted`
`SessionID`

Question
`Question1`
`Question2`
`Question3`

Answer
`Email`
`Question`
`Answer`

How can I populate the Answer table with a query from the Excel document? Or the initial table created from the Excel document on import? This seems like an easy problem but the solution is for some reason eluding me. Thanks for any help!

  • 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-28T00:15:33+00:00Added an answer on May 28, 2026 at 12:15 am

    Your data structure’s a bit screwed up. If you have three columns for Question1 through Question3, then you’d want a SurveyID column or something of the sort to identify the unique combinations. Then, your answer table would have UserID, SurveyID, Answer1, Answer2, and Answer3 columns.

    If your Question table has one Question column and a QuestionID column (hopefully an identity column so it auto-increments, then you’d do something like this to populate the Answer table from your Import table:

    insert into answer (userid, questionid, answer)
    select
        u.userid,
        q.questionid,
        case
            when q.question = 'Question1' then i.question1
            when q.question = 'Question2' then i.question2
            when q.question = 'Question3' then i.question3
            else null
        end as answer
    from
        import i
        inner join users u on
            i.email = u.email
        cross join question q
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a reasonable size flat file database of text documents mostly saved in
I have a bunch of posts stored in text files formatted in yaml/textile (from

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.