inserting null into DB

hi

I am encountering a problem as follows:
I have a text box called fax no on the form,
its stored into the dbase as numeric data field
now the problem is that i can't insert a null value
into the numeric field,
(that is in the absence of fax no)
What can i do in such a case???
I need to insert null into the DB, if fax no is not provided
instead of stopping the whole insert query.
talk2raj55 [ Mi, 03 Januar 2007 13:02 ] [ ID #1583588 ]

Re: inserting null into DB

talk2raj55 [at] gmail.com wrote:
> hi
>
> I am encountering a problem as follows:
> I have a text box called fax no on the form,
> its stored into the dbase as numeric data field
> now the problem is that i can't insert a null value
> into the numeric field,
> (that is in the absence of fax no)
> What can i do in such a case???
> I need to insert null into the DB, if fax no is not provided
> instead of stopping the whole insert query.

The answer depends on:
1. database type and version
2. the method you are using to insert the data - show us a code snippet


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
reb01501 [ Mi, 03 Januar 2007 13:15 ] [ ID #1583589 ]

Re: inserting null into DB

<talk2raj55 [at] gmail.com> wrote in message
news:1167825778.466742.303980 [at] h40g2000cwb.googlegroups.com.. .
> hi
>
> I am encountering a problem as follows:
> I have a text box called fax no on the form,
> its stored into the dbase as numeric data field
> now the problem is that i can't insert a null value
> into the numeric field,
> (that is in the absence of fax no)
> What can i do in such a case???
> I need to insert null into the DB, if fax no is not provided
> instead of stopping the whole insert query.

If you're using VBS, un-entered form fields will be an empty string, not
null. An empty string is always illegal for numeric fields, you'd have to
convert to null.

Also, there's nothing inherent to numeric fields that rules-out NULL;
whether or not the field will accept NULL is a settable property of that
field.

Lastly, phone numbers are typically stored as text, rather than numbers,
because of common output formatting goals (which will necessitate conversion
to text) and the fact that there are usually no math ops that make sense
with a phone number.


-Mark
mmcginty [ Mi, 03 Januar 2007 20:45 ] [ ID #1583590 ]

Re: inserting null into DB

Thanks a lot for the reply.
this should help me, further.
talk2raj55 [ Do, 04 Januar 2007 04:56 ] [ ID #1584764 ]
Webserver » microsoft.public.inetserver.asp.db » inserting null into DB

Vorheriges Thema: File upload problem
Nächstes Thema: questions about using asp variables to insert value into numeric column(bigint,int,money)