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

  • Home
  • SEARCH
  • 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 1108773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:08:06+00:00 2026-05-17T02:08:06+00:00

From my ASP.NET application I am calling an INSERT stored procedure, there is a

  • 0

From my ASP.NET application I am calling an INSERT stored procedure, there is a default value for one of the columns in the table that the INSERT procedure places the data into. How do I specify that I want the default value to be used instead? (Or do I have to specify the actual default value in my parameters)

SITUATIONAL TABLE:

Column 1: int
Column 2: string
Column 3: int default -1

SITUATIONAL STORED PROCEDURE

INSERT INTO TABLE
  (Column 1, Column 2, Column 3)
VALUES
  (?, ?, ?)

SITUATIONAL ASP.NET CODE

create paramter (Column 1, 12)
if (x = 0)
 {create parameter (Column 2, "test")}
else
 {
   create parameter (Column 3, 24)
   create parameter (Column 2, DBNull.Value)
 }

Thank you for your 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-17T02:08:07+00:00Added an answer on May 17, 2026 at 2:08 am

    Leave the column out of the insert clause, and you will get the default.

    For example in your procedure:

    IF condition
      INSERT INTO Y (X) VALUES(1); -- will use defaults
    ELSE
      INSERT INTO Y (W, X) VALUES(1, 2) -- won't use default for W
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a recommended way to bounce an asp.net application besides touching web.config from
I have a website running a basic ASP.NET application that is mostly used from
I'm trying to profile SQL reporting services, used from ASP.NET application. In SQL profiler
I'm trying to write a log file from an ASP.NET application under IIS7, but
I'm trying to write a log file from an ASP.NET application under IIS7, but
I'm using Web Services Enhancements 3.0 to call a web-service from an ASP.NET application
Trying to include ThickBox (from http://jquery.com/demo/thickbox/ ) in an ASP.NET application. Visual Studio is
I'm writing this question from the standpoint of an ASP.NET application. However I realize
Has anybody gone through the process of converting a real-world business application from ASP.NET
I'm creating an ASP.NET web application to schedule tasks on our server from a

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.