null form values and sql server stored procedures

Results 1 to 2 of 2

Thread: null form values and sql server stored procedures

  1. #1
    Join Date
    Dec 1969

    Default null form values and sql server stored procedures

    Hi,<BR>I have a wierd one, hopefully an easy one for the right person, I&#039;ll describe it the best I can.<BR><BR>I have a form that adds a new transaction. This transaction has a date field on it (cleared date), which on the SQL Server side is set to allow nulls and has no default value. If I enter the transaction without even touching the cleared date (as to leave it null), it gets entered as 1/1/1900!!<BR><BR>My form calls another asp page, which grabs the values of the previous page&#039;s form, and opens a connection, calls the stored procedure with the form&#039;s values, closes connection. Wallah.<BR><BR>But that wretched date is entered as 1/1/1900. I&#039;ve tried to do some more error checking, like if the length of it is zero, then enter the actual value of null, but it does the same thing.<BR><BR>It&#039;s hard for me to pinpoint how it could be doing this, so if any of you have ran into this, or helped someone else out with this kind of situation, please feel free to help me! Thanks a lot in advance, I appreciate it!

  2. #2
    Join Date
    Dec 1969

    Default 1/1/1900 == 0.0

    Somehow, you are getting a numerical value of zero in there, instead of a NULL. And a numerical value of zero, when treated as a smalldatetime data value, is indeed 1/1/1900.<BR><BR>Can&#039;t help you figure out why you aren&#039;t using null instead of zero. No idea what your SP is doing.<BR><BR>NOTE: You can *NOT* send a VBS NULL to a SP and have it seen as a SQL Server null! VBS NULL is not the same as SQL null. At all. You might want to test for a zero value in the SP and convert zero to null??<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts