Insert NULL via SP

Results 1 to 2 of 2

Thread: Insert NULL via SP

  1. #1
    Join Date
    Dec 1969

    Default Insert NULL via SP

    Hi,<BR>I&#039;m having some trouble inserting a NULL into a field.<BR><BR>Here are the facts:<BR><BR>Here is the Parameter:<BR>.Parameters.Add( New SqlParameter( "@ActiveStatus", SqlDbType.TinyInt, 4 ) )<BR><BR>.Parameters("@ActiveStatus").Value = intActiveStatus<BR><BR>Here is the stored procedure parameter:<BR>@ActiveStatus tinyint = NULL<BR><BR>I have intActiveStatus = Nothing. intActiveStatus is a Integer variable. If I change it to a String, it inserts Null if intActiveStatus = Nothing, but if it takes on a actual Integer, I guess it is not consistent with the SP and just inserts a 0. I dont know if something changed in .Net, but in classic ASP, this was fine. How do I get the SP to insert a NULL of a tinyint datatype if the value actually is NULL and not insert a 0. Thanks<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Insert NULL via SP

    I would suggest not passing a value to the parameter at all. It will default to NULL.

Posting Permissions

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