CREATE TRIGGER [student_update] ON [student] 
FOR UPDATE 
AS
	declare @xh char(8),@xm char(8),@xb char(2),@bh char(8),@tp char(40)
	declare @xhchange int

	select @xhchange = count(*) from baseinfo where ѧ not in (select ѧ from student)

	if @xhchange > 0 --ıѧŵĴ
		begin
			delete baseinfo where ѧ not in  (select ѧ from student)
			insert baseinfo(ѧ,,,Ա,ͼƬ) 
				select * from student where ѧ not in  (select ѧ from baseinfo)


		end
	else  --ıϢĴ
		begin
			
			update baseinfo
				set =b.,=b.,Ա=b.Ա,ͼƬ=b.ͼƬ
			from baseinfo as a,student as b
			where a.ѧ=b.ѧ and (a.<>b. or a.<>b. or a.Ա<>b.Ա or a.ͼƬ<>b.ͼƬ)	
			


		end
