September 8, 2006 at 8:47 am
I am trying to run the following code:
update HelpDetailsTechDesc
set TechnicalDescription = stg.TechnicalDescription
from stg_HelpDetailsTechDesc stg,
HelpDetailsTechDesc hdtd
Left join HelpDetails hd on stg.EventName = hd.title
where hd.HelpDetailsID = hdtd.HelpDetailsID and
hd.HelpTypeID = hdtd.HelpTypeID and
hd.HelpTypeID = 1
And am getting the following error:
Msg 4104, Level 16, State 1, Procedure iss_HelpDetails_PostUpdates, Line 28
The multi-part identifier "stg.EventName" could not be bound.
The 3 tables involved are:
stg_HelpDetailsTechDesc - it contains the new information to be used as the source information in the update. Relevant columns: EventName and TechnicalDescription.
HelpDetails - Needed to join the stg_HelpDetails to HelpDetailsTechDesc. Relevant columns: HelpDetailsID (PK), HelpTypeID (PK) always 1 in this situation, Title (which matches EventName).
HelpDetailsTechDesc - This is the table to be updated. Relevant columns: HelpDetailsID (PK), HelpTypeID (PK) always 1 in this situation, TechnicalDescription.
Very baffeld
September 8, 2006 at 8:55 am
Hello,
Try this one
update hdtd
set hdtd.TechnicalDescription = stg.TechnicalDescription
from stg_HelpDetailsTechDesc stg,
HelpDetailsTechDesc hdtd
Left join HelpDetails hd on stg.EventName = hd.title
where hd.HelpDetailsID = hdtd.HelpDetailsID and
hd.HelpTypeID = hdtd.HelpTypeID and
hd.HelpTypeID = 1
Thanks
Lucky
September 8, 2006 at 9:02 am
Lucky,
I tried your suggestion and still get the same error message.
Thanks ......... reiny
September 8, 2006 at 9:33 am
It might be because you are using old a new sql syntax.
try putting joins for all tables (even for the cross joins). That should be fix your error.
September 8, 2006 at 10:04 am
I changed to this:
update hdtd
set hdtd.TechnicalDescription = stg.TechnicalDescription
from stg_HelpDetailsTechDesc stg
Left join HelpDetails hd on stg.EventName = hd.title
left join HelpDetailsTechDesc hdtd on hdtd.HelpDetailsID = td.HelpDetailsID
where hd.HelpTypeID = hdtd.HelpTypeID and hd.HelpTypeID = 1
And now get this:
Msg 4104, Level 16, State 1, Procedure iss_HelpDetails_PostUpdates, Line 28
The multi-part identifier "td.HelpDetailsID" could not be bound.
September 8, 2006 at 10:50 am
Your version of the query is pretty much an inner join in disguise. Try this in case it works ?!?!
update hdtd
set hdtd.TechnicalDescription = stg.TechnicalDescription
from stg_HelpDetailsTechDesc stg
Left join HelpDetails hd on stg.EventName = hd.title AND hd.HelpTypeID = hdtd.HelpTypeID and hd.HelpTypeID = 1
left join HelpDetailsTechDesc hdtd on hdtd.HelpDetailsID = td.HelpDetailsID
September 8, 2006 at 11:42 am
I changed the command to this:
update hdtd
set hdtd.TechnicalDescription = stg.TechnicalDescription
from stg_HelpDetailsTechDesc stg
left join HelpDetails hd on stg.EventName = hd.title
left join HelpDetailsTechDesc hdtd on hdtd.HelpDetailsID = td.HelpDetailsID and
hd.HelpTypeID = hdtd.HelpTypeID
And now I get this:
Msg 4104, Level 16, State 1, Procedure iss_HelpDetails_PostUpdates, Line 28
The multi-part identifier "td.HelpDetailsID" could not be bound.
September 8, 2006 at 12:22 pm
Can we see the full procedure??
September 8, 2006 at 12:31 pm
Here is the full procedure:
IF OBJECT_ID('ss_HelpDetails_PostUpdates') IS NOT NULL
DROP PROCEDURE dbo.ss_HelpDetails_PostUpdates
go
-- exec ss_HelpDetails_PostUpdates
CREATE PROCEDURE dbo.ss_HelpDetails_PostUpdates
AS
-- Copyright (c)
BEGIN
SET NOCOUNT ON
DECLARE @RunTime datetime
select @RunTime = getdate()
update HelpDetails
set CreatedAt = s.CreatedAt,
Spreading = s.Spreading,
Damage = s.Damage,
VirusType = s.VirusType,
Symptom = s.Symptom,
Alias = s.Alias,
RemovalInstructions = s.RemovalInstructions,
RemovalLink = s.RemovalLink,
LastModifiedAt = @RunTime
from stg_HelpDetails s,
HelpDetails hd
where hd.title = s.EventName and
hd.HelpTypeID = s.HelpTypeID
update hdtd
set hdtd.TechnicalDescription = stg.TechnicalDescription
from stg_HelpDetailsTechDesc stg
left join HelpDetails hd on stg.EventName = hd.title
left join HelpDetailsTechDesc hdtd on hdtd.HelpDetailsID = td.HelpDetailsID and
hd.HelpTypeID = hdtd.HelpTypeID
--DELETE stg_HelpDetailsTechDesc
-- from stg_HelpDetailsTechDesc stg
-- left join HelpDetails hd on stg.EventName = hd.title
-- Where hd.lastModifiedAt = @RunTime
--DELETE stg_HelpDetails
-- from stg_HelpDetails stg
-- left join HelpDetails hd on stg.EventName = hd.title
-- Where hd.lastModifiedAt = @RunTime
END
GO
September 8, 2006 at 12:39 pm
I got nothing to offer !
September 11, 2006 at 6:13 am
It was a simple typo.
The td. should be hd.
Thanks for all who helped!
November 14, 2007 at 1:57 pm
A quick thank you to those who posted help here, I was able to resolve a similar issue with the advice listed here and a search of the forums!
Viewing 12 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy