Solved

Insert Null into sql??

Posted on 2003-12-04
1
539 Views
Last Modified: 2012-05-04
Hey so I have a sql insert string we'll say:
Insert INTO FooTable (val1,val2,val3) values (@val1,@val2,@val3)

I go through and add the parameters.
Now when adding the values, that can depend on what is read by the application. The problem is if the value is null.
if it is null I want to have the database be null. But the requirement for this null changed from when I originally built the app, so I can't have it dynamically create the string. Basically I want to know if I can have the value = null?

0
Comment
Question by:jj819430
1 Comment
 
LVL 18

Accepted Solution

by:
testn earned 500 total points
ID: 9876705
Just set the parameter to DBNull.Value
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question