Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add null fields

Status
Not open for further replies.

NICKYSUWANDI

Programmer
Jan 8, 2004
80
ID
i am using mysql database, i had trouble when update null fields.

Example:
mytable: field1 decimal 10
field2 decimal 10

i want to update field1 and field2 using this string command:

UPDATE mytable SET field1 = field1 + 1,field2 = field2 + 1
(this command will working if field1 and field2 value >= 0 and it will still null value when frist value for field1 and field2 is null).
my question:
1.how to solve this problem?
2.can we got deleted rows in datagrid(row values)?

Thanks

Nicky

 
not too sure about mySQL syntax, but if this were SQL then I would check for a null value and replace it with 0 prior to doing the addition..

something like:

Update isnull(field1, 0) + 1 as field1
blah....
 
thanks tEkHEd

the rights syntax is :
Update isnull(field1) + 1

this is not solve my problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top