Urgent : Insert Null into Datetime field

Posted on 2002-03-15
Last Modified: 2008-02-01
Hi All,

How do I insert Null value into datetime field from
my VB Dll.

Thanks and Regards,
Question by:mukeshkm
  • 2
  • 2
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6867598
The answer depends on the way you are currently working:
* using SQL statements
* using updatable recordsets
* using stored procedures

Please indicate, maybe including your code that doesn't work.


Author Comment

ID: 6867623
Hello angellll

what Iam looking at is inserting a record using
SQL statement in my VB function. A friend of mine
put this question to me. Sorry I donot have the
source ...

LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6867635

sql = "INSERT INTO yourtable (col1, col2, datecol) VALUES ( 1,2, NULL )"

If you have SQL string you want to execute, you give NULL as value (no quotes, no brackets).


Accepted Solution

simonsabin earned 200 total points
ID: 6867983
If you are using a recordset then set the value of the relevant field to vbNull

Author Comment

ID: 6868042
thanks simonsabin it works

thanks to angelll too


Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Attaching Database Failed ? 3 39
sql server concatenate fields 10 31
Get the latest status 8 29
Query to capture 5 and 9 digit zip code? 4 20
Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

785 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