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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update statment

Status
Not open for further replies.

annub

Programmer
Apr 23, 2003
33
US
I am using VB 6 with SQL 8.I want to update 2 col on my table. I am doing something like this .. Gives me syntex error. I am not sure if i can use alias in update statment , Is it possible to update 2 col at same time ...

update laborefficiency l
set l.itemno = b.itemno
from baandirecthrb19 b,laborefficiency l
where b.itemno not like 'null'
and l.jobnumber = b.jobnumber
 
Do not need the "like"

update laborefficiency l
set l.itemno = b.itemno
from baandirecthrb19 b,laborefficiency l
where b.itemno IS NOT NULL
and l.jobnumber = b.jobnumber

Thanks

J. Kusch
 
Do you want the check on the string 'null' or to check if the field is null.

You can't alias in the update statement but in the form statement

update laborefficiency
set itemno = b.itemno
from baandirecthrb19 b,laborefficiency l
where b.itemno is not null
and l.jobnumber = b.jobnumber

or

update laborefficiency
set itemno = b.itemno
from laborefficiency l
join baandirecthrb19 b
on l.jobnumber = b.jobnumber
where b.itemno is not null

or

update l
set itemno = b.itemno
from laborefficiency l
join baandirecthrb19 b
on l.jobnumber = b.jobnumber
where b.itemno is not null


======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top