Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting a null value? 1

Status
Not open for further replies.

bigtrick

Programmer
Aug 1, 2001
4
US
Hey,

I'm trying to insert a row into an access database. problem is, how do i get one of the fields to insert as a null value?

i'm using java server pages, and the way i have it set up it's not possible for me to "skip" a field - that is, the JSP must insert a value for every field that exists in the table. is there some sort of value that i can pass that access will interpret as a null?

thx.
 
I don't know if it's possible or not for your application but you could place a zero length string (""). It's not null but maybe it'd work for you?

Joe Miller
joe.miller@flotech.net
 
Nope, using "vbNull" doesn't work. And zero-length strings are what got me into this mess.... i can insert them, but it messes up the joins that i have going in a separate recordset. There's got to be some way just to tell access to make it null..... right?
 
keep in mind, all this is via an sql statement that my java server page passes to access....
 

Use the NULL keyword. For example to inset NULL in col3 of tbl do the following.

Insert tbl (col1, col2, col3, ...)
Values (val1, val2, NULL, ...)

If this doesn't work or you have questions, please post the INSERT query to help us help you. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it if you have time.
 
insert into STUDENT (Last_Name,Email_Address,First_Name,Sex,Address,Race,City,Ty
pe,State,Evaluation,Zip,Recom_Action,Telephone,Refer_Divisio
n,MAJOR_GROUP,HIRING_STATUS,Degree,Employee_Number,Graduatio
n_Date,Comment) values
('Schmo','','Joe','','','','','','','',NULL,'','','','','','
',NULL,NULL,'')

hmmm..... i've got some ideas already...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top