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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:55:48+00:00 2026-05-30T19:55:48+00:00

I have two stored procedures. One (test_proc_outside) makes a call to a second one

  • 0

I have two stored procedures. One (test_proc_outside) makes a call to a second one (test_proc_inside).

When I create a new LINQ to SQL .dbml file visually by dragging over my test_proc_outside stored proc, the generated class (test_proc_outsideResult) actually contains the modelling for the inner proc’s (test_proc_inside) result set.

Here is the code for the outside stored proc (test_proc_outside):

CREATE PROCEDURE [dbo].[test_proc_outside] 
@test1 int = 1, 
@test2 int = 2,
@test3 int = 3

AS
BEGIN
— SET NOCOUNT ON added to prevent extra result sets from
— interfering with SELECT statements.
SET NOCOUNT ON;

-- The result of this proc call gets modelled into DBML:
EXEC dbo.test_proc_inside @test1, @test2

-- This SELECT statement does NOT get modelled into DBML:
SELECT  @test1 AS Test1,
        @test2 AS Test2,
        @test3 AS Test3

END
GO

Here is the code for the inside stored proc (test_proc_inside):

CREATE PROCEDURE [dbo].[test_proc_inside] 
-- Add the parameters for the stored procedure here
@test1 int = 1, 
@test2 int = 2

AS
BEGIN
— SET NOCOUNT ON added to prevent extra result sets from
— interfering with SELECT statements.
SET NOCOUNT ON;

-- This is the result set that gets modelled by the DBML file:
SELECT  @test1 AS Test1_Inside,
        @test2 AS Test2_Inside

END
GO

It appears that the DBML generation looks for the very first result set in the stored procedure (or nested stored procedures) and spits out the model for that.

If I change the nested proc call to a function instead, I get my desired model (test_proc_outside).

Is there a configuration setting to tell the DBML file to generate the class for the result set on the outside proc (test_proc_outside) and not to bother with the inner results from test_proc_inside?

Thanks in advance,

Craig

  • 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-30T19:55:49+00:00Added an answer on May 30, 2026 at 7:55 pm

    I think it’s possible to get the result you want with L2S but you also have to get all the other results as well. You can’t do it with the designer, you’ll have to map the sproc by extending the DataContext in a partial class with a method that returns an instance of the IMultipleResults interface. See this blog post:

    http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/05/16/linq-to-sql-tips-7.aspx

    Also, if the stored proc is returning result sets that don’t map to entity in your L2S model, you’ll need create special types to represent those results manually by defining them in code the same way L2S normally generates types for stored procedure results in its designer.cs.

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

Sidebar

Related Questions

I have two stored procedures, the first one calls the second .. If I
I have two sql files: The first one creates database, tables, and stored procedures.
I have two servers, the first one with SQL Server 2005 and the second
I have two SQL Stored Procedure. One from test environment and other is on
I have two stored procedures, one of which returns a list of payments, while
We have two stored procedures in Microsoft SQL Server that return data that is
I have two databses on a SQL Server -- one for development (call it
Workflow: I have two stored procedures. One stored procedure calls the other. When I
I have two inputs for my stored procedure. One is the 'RoledID' and second
I have two stored procedures I wish to use in my stored procedure, but

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.