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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:06:03+00:00 2026-05-14T23:06:03+00:00

Basically I have a User-Defined Table Type (for use as a table-valued variable) which

  • 0

Basically I have a User-Defined Table Type (for use as a table-valued variable) which I’m referencing in a stored procedure that effectively just calls two other stored procedures, then inserts those values into the table type.

Id est

INSERT INTO @tableValuedVariable (var1, var2, var3, var4, var5)
         EXEC [dbo].StoredProcedure1;

INSERT INTO @tableValuedVariable (var1, var2, var5)
         EXEC [dbo].StoredProcedure2;

You can probably already tell what I’m going to ask. Basically StoredProcedure2 only returns a few of the values the table is set to hold, and I’d like those other variables to just be null (as defined as default). Only SQL is complaining that I’m not specifying all the variables available to that table.

The return datasets can be quite sizable so I’d like to avoid loops and such for obvious reasons.

Thanks for any help.

  • 1 1 Answer
  • 3 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-14T23:06:03+00:00Added an answer on May 14, 2026 at 11:06 pm

    You have list all columns in the INSERT clause to match all columns from the stored proc.

    Now, if the stored proc returns var1, var2, var5 then there should be no need to specify var3, var4 in the INSERT clause if they are NULLable. (Edit: of course, as Mike Burton pointed out, it will fail if the columns are NOT NULL)

    If the stored proc returns var1, var2, var3, var4, var5 then you need all 5 in the INSERT clause: you can’t ignore columns from the stored proc and allow them to default.

    You could change the stored proc to a udf and SELECT var1, var2, var5 FROM mynewUDF()

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

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I doubt that there's such a website with the same… May 16, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer Try GDB 7.2. There have been many fixes since 6.8,… May 16, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer I'm not a 100% sure, but from the sourcecode it… May 16, 2026 at 11:30 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Here's my user-defined table type... CREATE TYPE [dbo].[FooType] AS TABLE( [Bar] [INT], ) This
SQL 2008 I have a commission table that looks like this: Comm% | ProfitStartRange
I have an SQL table with basically the following structure: PK (int, primary key),
Basically, I have a table. Onload, I set each row of the table to
List -> l_user I have a List node that has a user-reference field (
I want to allow the user to define a query which will be used
I have a table with a TestNumber column with four possibilites (ex: 1 -
Basically I have a three view stack. In the last view I got a
So basically i have 2 treeviews running next to each other, one shows a
I have some basic questions about core data (which I am new to) and

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.