How to enter an empty integer field in SQL query

what would be the equivilent of a '' for an integer?

Page 1 of 1

2 Replies - 4384 Views - Last Post: 24 July 2009 - 11:29 AM Rate Topic: -----

#1 Paat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 21-July 09

How to enter an empty integer field in SQL query

Posted 24 July 2009 - 09:29 AM

in my sql, i've been able to add empty string (varchar) fields by simply putting '' as their value. Now im wondering how I can do the same for integer fields? Would anyone know how to do this?

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: How to enter an empty integer field in SQL query

#2 ForcedSterilizationsForAll  Icon User is offline

  • D.I.C Addict

Reputation: 33
  • View blog
  • Posts: 506
  • Joined: 16-July 09

Re: How to enter an empty integer field in SQL query

Posted 24 July 2009 - 09:33 AM

View PostPaat, on 24 Jul, 2009 - 08:29 AM, said:

in my sql, i've been able to add empty string (varchar) fields by simply putting '' as their value. Now im wondering how I can do the same for integer fields? Would anyone know how to do this?

Thanks



I usually use 0 for the default value when NULL isn't an option.
Was This Post Helpful? 0
  • +
  • -

#3 woodjom  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 29
  • View blog
  • Posts: 549
  • Joined: 08-May 08

Re: How to enter an empty integer field in SQL query

Posted 24 July 2009 - 11:29 AM

Well im not sure about MySQL anymore but with MS-SQL, you can use DBNull as a null value.

I personally never use DBNull for a field. I always fill them in. For Numeric values i use -1 as a Null, String = "NOTHING", and DateTime = #1/1/1900#.

But thats just me. I also never use the numeric 0 as a data point.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1