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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:47:33+00:00 2026-05-22T15:47:33+00:00

I have a sproc that returns at least 4 columns and then n columns

  • 0

I have a sproc that returns at least 4 columns and then n columns after that (it’s the result of a Pivot).

I can’t create a quick Type to declare the result set shape to use with Linqtosql because I don’t actually know what the shape will be.

Since Linqtosql is my DAL, I want to stick with it if possible – I don’t want to back to untyped DataSets, do I?

How can I get LinqToSql to return a sproc result with a variable number of properties/columns?

Thanks.

  • 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-22T15:47:34+00:00Added an answer on May 22, 2026 at 3:47 pm

    LINQ-to-SQL needs to map your database objects to concrete types. So, in short, you can’t do this.

    There are workarounds. I expect that the best outcome would be to map your n columns to a collection inside each data object.

    If you can change your database schema to instead use a parent-child View pattern, rather than a single dynamic sproc, the LINQ-to-SQL will be able to map this. For example, you’d have your first 4 columns in a ‘parent’ view, and each subsequent column in your existing proc would become a row in a ‘child’ view which needs to reference the parent view.

    Another alternative – simpler but dirtier – would be to return a single column containing your current n columns in CSV format (or other delimiter). You then parse this single value into a collection. Ugly but simple.

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

Sidebar

Related Questions

I have a stored procedure that returns a result set (4 columns x n
I have a sproc that returns a single line and column with a text,
I have a stored procedure that returns all fields of an object. CREATE PROCEDURE
In oracle, I want to create a delete sproc that returns an integer based
I have a data caller method that returns a SubSonic collection of type ItemDatumCollection.
I had a sproc that executed a select statement, result was a single column
I have a temporary table I'm creating in a sproc that houses my user
I currently have a sproc that is exporting data to a csv file using
I have a stored procedure that, depending on the input, returns multiple rows of
I have a function GetAlertData() that returns a Datatable. I invoke it as: var

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.