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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:59:00+00:00 2026-05-13T14:59:00+00:00

I have a bit of an interesting problem where I need to create an

  • 0

I have a bit of an interesting problem where I need to create an Excel data dump from some data in the database, but rather than it being something simple I have some complex data to merge, below is an example of the data that I have to deal with.

TblGeneralInfo

RecordId|Record Name  |Date      |Cost
1       |Test Entry  | 1/1/2010 |2.0
2       |Test Entry2 | 1/1/2010 |20.25

TblRandomInfo

RecordId |QuestionName   | Answer
1        |Your Name?     | Bob
1        |Your Title?    | The Builder
2        |Favorite Movie | The Matrix
2        |Favorite Car   | Mustang

What I need in the end is the following

RecordId|Record Name |Date      |Cost  |              |            |              |
1      |Test Entry  | 1/1/2010 |2.0   |Your Name?    | Bob        | Your Title?  | The Builder
2      |Test Entry2 | 1/1/2010 |20.25 |Favorite Move | The Matrix | Favorite Car | Mustang

Now I’m using SQL Server 2005 for the reporting and ASP.NET 3.5 (C#) for the application. I’m looking for the best way to do this. The number of items in “tblRandomInfo” is variable, and can have as many as 20-30 Q/A pairs per record. I cannot easily do a pivot, even a dynamic pivot due to the nature of the data.

Edit

A solution is valid either on the SQL Server or C# side. But note that information in tblRandomInfo can contain line breaks.

  • 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-13T14:59:00+00:00Added an answer on May 13, 2026 at 2:59 pm

    Is the issue that you are trying to create a T-SQL query that will make a table like your desired output?

    I’m sure it can be done, but why not create the output in the c# application? The easiest thing is to write out a csv.

    1. pull TblGeneralInfo records
    2. pull TblRandomInfo records
    3. for each record in TblGeneralInfo write RecordId, RecordName, Date, and Cost
    4. for each record in TblRandomInfo that has a RecordId matching the TbGeneralInfo record, write QuestionName and Answer
    5. newline

    Of course, you can do this with interop, as well, as long as you have Excel installed on the server, but that adds complexity with rather little benefit over the csv.

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

Sidebar

Related Questions

I have a bit of a unique problem with an upcoming project; I need
This is a bit of a stretch, but I have an interesting (to me)
I have stumbled upon an interesting problem/bug that I eventually solved, but the solution
This design problem is turning out to be a bit more interesting than I'd
I have an interesting bitmask puzzle problem I need help solving in something. Here
Have a bit of confusion here. I added a few objects from a class
I have a bit of a theoretical question, however it is a problem I
I have a bit of code that fits theoretical prediction to experimental data, and
I have a bit of a problem that I can't seem to code my
I have a bit of a strange problem. I have a music app that

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.