Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    104

    Unanswered: Null values in INSERT

    How can I pass a null value with INSERT statement?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    using the NULL keyword:
    Code:
    insert into yourtable (foo, bar, qux, fap)
    values ('one',2,'buckle my shoe',null)
    or by omitting that column from the insert:
    Code:
    insert into yourtable (foo, bar, qux)
    values ('one',2,'buckle my shoe')
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Buckle My Shoe?? You have waaay to much fun answering these SQL questions, Rudy!

    Just a small point of clarification (and I could very well be wrong), if fap has a default value of "sna", when you omit the column value in the insert statement, you won't get null, you'll get the default, then you'll be foo-bar'd
    All code ADO/ADOX unless otherwise specified.
    Mike.

Posting Permissions

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