发布网友 发布时间:2022-04-07 19:55
共1个回答
热心网友 时间:2022-04-07 21:24
SELECT * FROM Patients where WID in ('1','3','5')
select D.DName,P.PName from Doctors as D left join Patients as P on D.DID = P.DID
创建一个修什么的特定编号,看不清,我按照给一个编号和要修改的学历信息而创建的存储过程(写的不是很专业见谅)
存储过程if exists (select * from sys.objects where name = 'procUAca')
drop proc procUAca
go
create proc procUAca(@did int,@aca nvarchar(50))
as
if not exists (select * from sys.objects where name = 'Doctors')
print '没有找到表'
begin
begin transaction
update [dbo].[Doctors] set [AcaCredentials] = @aca where [DID] = @did
if(@@ERROR<>0)
begin
rollback transaction
print '更新资料失败'
end
else
begin
commit transaction
print '更新资料成功'
end
end
go
--调用、执行存储过程
declare @did int,@aca nvarchar(50);
set @did = 1
set @aca= '大专学历';
exec procUAca @did,@aca;