I intend to write a procedure in SqlServer that can update the joined tables,in my case i have two tables (HowzeEducation & HowzeDegree) so i have written the following query but it has errors and does not work properly.Here is my code:
declare
@HowzeEducationId int,
@DegreeId int,
@FieldName nvarchar(50),
@FinishLevelDate date,
@Average decimal(4,2),
@SchoolName nvarchar(50),
@StudyCityDescribtion nvarchar(100),
@ThesisTitle nvarchar(200),
@Describtion nvarchar(600)
update (
select he.FieldName,
he.Average,
he.Describtion,
he.FinishLevelDate,
he.SchoolName,
he.StudyCityDescribtion,
he.ThesisTitle,
hd.DegreeId
from HowzeEducation he inner join HowzeDegree hd on
he.HowzeEducationId=hd.HowzeEducationId
)
set he.FieldName=@FieldName ,
he.Average=@Average,
he.Describtion=@Describtion,
he.FinishLevelDate=@FinishLevelDate,
he.SchoolName=@SchoolName,
he.StudyCityDescribtion=@StudyCityDescribtion,
he.ThesisTitle=@ThesisTitle,
hd.DegreeId=@DegreeId
where he.HowzeEducationId=@HowzeEducationId
How can solve this problem?