0

I am asp.net developer and I work with SQL Server 2005 .

I have a table with 4 columns

say

  1. Name
  2. RollNo
  3. Std
  4. Div

if client enters

  1. Name
  2. RollNo
  3. Std

but doesn't enters 4.Div column data and try's to save data, it should not give error, it should save the data in database

3
  • is the Div column non-nullable? Commented Dec 5, 2010 at 2:59
  • if yes what will be the problem ? and if not then what will be the problem ? can u kindly explain ?? Commented Dec 5, 2010 at 3:02
  • 2
    @user404305, if you have the column set for non-nullable it will be expecting a value, if you don't provide one, your user will get an error screen and the insert won't go through. If the column allows nulls then the insert will go through fine with no data for the column. Commented Dec 5, 2010 at 3:04

3 Answers 3

1

So it is giving you an error? Make sure that you set 4. Div column to "Allow Nulls"(No value).

It's also good to know that SQL Server can be set up to insert a default value if one isn't provided.

Sign up to request clarification or add additional context in comments.

Comments

0

HI,

That means that you need to save with either default division for standard or null value.

You can setup in database to allow null and do not pass anything and that saves the data with null values.

Otherwise, I think you should put default value in Div for that standard. So whenever you dont pass that value in Insert statement, it takes default one.

Will it help or do I misunderstood it?

Comments

0

If I understand your problem, you're going to have NULL in one of your fields (provided you allow nulls in the fields). Depending on where you're experiencing your problem, your code would need to test for NULL from the information a client inputs or your code will need to test for NULL when it retrieves the information.

If you're running into an error, it might be prudent to post details of the error as well.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.