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
 change from implicit join to explicit join

Author  Topic 

anjali5
Posting Yak Master

121 Posts

Posted - 2014-01-03 : 16:48:05
Hi All,

I am trying to convert from implicit joins to explicit join. Below is the quey that I need to change



update history
set C.nha_name_abbr = S.name_abbr ,
C.nha_pn_mk_mod = S.pn_mk_mod,
C.nha_sn = S.sn,
C.nha_mfr_lot = S.mfr_lot,
C.nha_dup_flag = S.dup_flag
from history C, MEDS.dbo.status S
where C.nha_key_id_no *= S.key_id_no

and C.nha_key_id_no > 0
and process_userid = @entry_userid



after I changed it, I have the query below



update history
set C.nha_name_abbr = S.name_abbr ,
C.nha_pn_mk_mod = S.pn_mk_mod,
C.nha_sn = S.sn,
C.nha_mfr_lot = S.mfr_lot,
C.nha_dup_flag = S.dup_flag
from history C LEFT OUTER JOIN MEDS.dbo.status S
ON (C.nha_key_id_no = S.key_id_no)
where
and C.nha_key_id_no > 0
and process_userid = @entry_userid


when I put those changes, I am getting an error saying
The multi-part identifier "C.nha_name_abbr" could not be bound.

I am not sure what am I doing wrong.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-01-03 : 16:55:33
[code]
update C
set
nha_name_abbr = S.name_abbr ,
nha_pn_mk_mod = S.pn_mk_mod,
nha_sn = S.sn,
nha_mfr_lot = S.mfr_lot,
nha_dup_flag = S.dup_flag
from history C
LEFT JOIN MEDS.dbo.status S
ON C.nha_key_id_no = S.key_id_no
where
C.nha_key_id_no > 0
and process_userid = @entry_userid
[/code]

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

anjali5
Posting Yak Master

121 Posts

Posted - 2014-01-03 : 17:04:10
Thanks.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-01-03 : 17:05:01


Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -