更新时间:2023-11-24 14:10:46
您可以打开级联删除
[ ^ ],允许您删除外键行。
You can turn on Cascade Delete
[^] which will allow you to allow you to delete foreign key rows.
如果我们知道你在更新或删除时可用的字段会有所帮助,但在这里我会假设你有这些字段在用户表中。
更新
Hi,
It would help if we knew what fields you have available on update or delete, but here I will assume you have al the fields in the user table.
For Update
Create Procedure ProcUpdateUser()
@logid int,
@name varchar(50)
as
begin
update user set name=@name where log_id=@logid
update login set username=@name where log_id=@logid
end
删除
For Delete
Create Procedure ProcDeleteUser
@name varchar(50)
as
begin
delete user where name=@name
delete login where username=@name
end
您需要根据需要更改参数,但希望这会有所帮助。
You will need to change the parameters according to your needs but hope this helps.