Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 if the value is 'null 'dont update anything

Author  Topic 

a.ashabi
Posting Yak Master

117 Posts

Posted - 2007-11-07 : 18:23:07
Hi.I have a update query:

UPDATE test1
SET testprice= ((unitprice*8)/100) + unitprice

it's good.but I dont want to change the testprice if the unitprice is NULL.what should I do?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-11-07 : 18:31:14
UPDATE test1
SET testprice = ((unitprice*8)/100) + unitprice
WHERE unitprice IS NOT NULL

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

a.ashabi
Posting Yak Master

117 Posts

Posted - 2007-11-07 : 18:47:42
thank u.
Go to Top of Page
   

- Advertisement -