ASP SQL Insert NULL Date Value
From: Chad S (webaccess_at_hotmail.com)
Date: 02/19/04
- Next message: newbie: "Re: Newbie - Stored Procedures/ASP Question"
- Previous message: Bob Barrows [MVP]: "Re: Newbie - Stored Procedures/ASP Question"
- Next in thread: Bob Barrows [MVP]: "Re: ASP SQL Insert NULL Date Value"
- Reply: Bob Barrows [MVP]: "Re: ASP SQL Insert NULL Date Value"
- Reply: Aaron Bertrand - MVP: "Re: ASP SQL Insert NULL Date Value"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Feb 2004 08:19:04 -0800
Hello,
I've been pulling my hair out trying to figure this out. Thank you in
advance for taking the time to look at this.
I'm trying to insert a NULL value into my SQL Server 2000 database. I
have a datetime field called 'ProcedureDate' that is allowing NULL
values. When inserting a NULL, SQL always puts the date 1/1/1900. I'm
trying to leave this field blank if no date is entered.
Thank's Again !
Chad
------------------------
Here is my ASP Code that sets a NULL value if there is no date entered:
<%
If Request.Form("sProcedureDate1") = "0" OR
Request.Form("sProcedureDate2") = "0" OR Request.Form("sProcedureDate3")
= "0" Then
sProcedureDate = NULL
Else
sProcedureDate = Request.Form("sProcedureDate1") & "/" &
Request.Form("sProcedureDate2") & "/" & Request.Form("sProcedureDate3")
End If
%>
------------------------
Here is my ASP SQL Insert Code:
<%
rsInsert = "INSERT into tblProceduralInfo (" &_
"PatientID, " &_
"ValvePlacementDuring, " &_
"ValvePlacementIn, " &_
"PatientAdmittedTo, " &_
"ProcedureDate, " &_
"StartTime, " &_
"EndTime " &_
")"
rsInsert = rsInsert & "VALUES" &_
"('" & Request.Form("sPatientID") &_
"', '" & Request.Form("sValveDuring") &_
"', '" & Request.Form("sValveIn") &_
"', '" & Request.Form("sPatientAdmitted") &_
"', '" & sProcedureDate &_
"', '" & sStartTime &_
"', '" & sEndTime &_
"')"
objConn.Execute(rsInsert)
%>
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: newbie: "Re: Newbie - Stored Procedures/ASP Question"
- Previous message: Bob Barrows [MVP]: "Re: Newbie - Stored Procedures/ASP Question"
- Next in thread: Bob Barrows [MVP]: "Re: ASP SQL Insert NULL Date Value"
- Reply: Bob Barrows [MVP]: "Re: ASP SQL Insert NULL Date Value"
- Reply: Aaron Bertrand - MVP: "Re: ASP SQL Insert NULL Date Value"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|