Results 1 to 5 of 5

Thread: Insert <NULL> into SQL

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    USA
    Posts
    74

    Thumbs down Insert <NULL> into SQL

    Hi,

    Am writing an update statement to one of my SQL tables. I have fields which are <NULL> I want them to remain so after the update. When I update they either become blank or Null.
    How can I keep them <NULL>.

    Any help would be appreciated.
    Thanks
    Manju

  2. #2
    New Member
    Join Date
    Oct 2003
    Posts
    14
    Shouldn't be happening
    Show us your SQL statement

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    USA
    Posts
    74
    If (AccountName = "") Then
    SqlComm.CommandText = "UPDATE Accounts SET " + _
    " Name = " + DBNull.Value + " WHERE AccountKey = " + AccountKey.ToString()
    End IF

    The above SQL statement inserts blank into the column.
    Thanks
    Manju

  4. #4
    New Member
    Join Date
    Oct 2003
    Posts
    14
    Do it in SQL.
    Code:
    "UPDATE accounts SET name = NULL where accountkey = " + accountkey.tostring()
    syntax might be different for different databases but it works fine for me on MS SQL Server

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    USA
    Posts
    74

    Thumbs up

    Thanks a lot...
    Thanks
    Manju

Posting Permissions

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



Click Here to Expand Forum to Full Width