Nulls...Oh how I love them - Not

Results 1 to 3 of 3

Thread: Nulls...Oh how I love them - Not

  1. #1
    Join Date
    Dec 1969

    Default Nulls...Oh how I love them - Not

    Hi,<BR><BR>Im trying to insert a NULL value into a Varchar field using a stored procedure called from an asp file. Instead however Im finding that a &#039;&#039; (blank) is getting inserted. Can anyone tell me what I may be doing wrong...Below is the code from the ASP and the stored procedure...the Field below that Im trying to insert a Null is Username<BR><BR> adoCmd.CommandText = "spInsertTask"<BR> <BR> adoCmd.Parameters.Refresh<BR> adoCmd.Parameters("@TaskTypeID") = sTaskTypeID<BR> adoCmd.Parameters("@PolicyNo") = sPolNo<BR> adoCmd.Parameters("@AgencyNo") = sAgentBranch&sAgentNo<BR> adoCmd.Parameters("@ClientName") = sClientName<BR> adoCmd.Parameters("@AgentName") = sAgentName<BR> adoCmd.Parameters("@DeptID") = sDeptID<BR> adoCmd.Parameters("@TeamID") = sTeamID<BR> adoCmd.Parameters("@UserName") = NULL<BR> adoCmd.Parameters("@Due_Date") = sDueDate<BR> <BR> &#039;Call the Store Procedure which will do insert <BR> adoCmd.Execute <BR><BR><BR> ****STORED PROCDEDURE INSERT TASK****<BR>Insert Into Task<BR>(TaskTypeID ,PolicyNo ,AgencyNo,ClientName, AgentName, DeptId ,TeamId ,UserID ,Due_Date ,Status)<BR>Values (@TaskTypeID, @PolicyNo, @AgencyNo, @ClientName, @AgentName, @DeptId, @TeamId, @UserName, @Due_Date, 1)<BR>select @@identity from task

  2. #2
    Join Date
    Dec 1969

    Default RE: Nulls...Oh how I love them - Not

    Just leave that line out!<BR><BR>adoCmd.Parameters("@UserName") = NULL<BR><BR>That will insert NULL into the field, make sure it is allowing null values!

  3. #3
    VBGuy Guest

    Default RE: Nulls...Oh how I love them - Not

    If that doesn&#039;t work, see Q177187 in MSDN.

Posting Permissions

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