PeterBaileyUk
asked on
sql update
I am trying to create an update query where the tw.StrCommon field is updated to the result of the IIF but It says it cannot bind the tw.StrCommon.
The query as a select works fine.
the select query which works fine
The query as a select works fine.
CREATE PROCEDURE [dbo].[usp_UpdateStrCommon]
AS
BEGIN
UPDATE dbo.TblWords
SET tw.StrCommon= IIF(tsdl.StrShort IS NULL, tw.StrShort, tsdl.StrCommon)
FROM TblWords tw LEFT JOIN TblShortDescLink tsdl ON tsdl.StrShort = tw.StrShort
END
the select query which works fine
SELECT tw.strshort, IIF(tsdl.StrShort IS NULL, tw.StrShort, tsdl.StrCommon) AS StrTemp
FROM TblWords tw LEFT JOIN TblShortDescLink tsdl ON tsdl.StrShort = tw.StrShort
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try this
Open in new window