--删除学生信息declare @tran_name varchar(30),@StuId char(10)
select @tran_name = 'students_delete'
@StuId = '2010121009'
begin tran @tran_namego
delete from dbo.Students where dbo.Students.cStudentsId = @StuId
go
delete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuId
go
delete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
go
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
go
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuId
go
delete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuId
go
delete from dbo.Education where dbo.Education.cStudentsId = @StuId
go
delete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId =--删除学生信息declare @tran_name varchar(30),@StuId char(10)
select @tran_name = 'students_delete'
@StuId = '2010121009'
begin tran @tran_namego
delete from dbo.Students where dbo.Students.cStudentsId = @StuId
go
delete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuId
go
delete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
go
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
go
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuId
go
delete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuId
go
delete from dbo.Education where dbo.Education.cStudentsId = @StuId
go
delete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId = @StuId
go
commite tran 'students_delete'go
commite tran 'students_delete'
各位,我要删除--删除学生信息declare @tran_name varchar(30),@StuId char(10)
select @tran_name = 'students_delete'
@StuId = '2010121009'
begin tran @tran_namego
delete from dbo.Students where dbo.Students.cStudentsId = @StuId
go
delete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuId
go
delete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
go
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
go
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuId
go
delete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuId
go
delete from dbo.Education where dbo.Education.cStudentsId = @StuId
go
delete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId = @StuId
go
commite tran 'students_delete'各位, 我要删除 @StuId = 2010121009的所有表中有关的行记录,但是执行的时候老是有 @StuId没有声明,那么声明该写在哪里呢,谢谢,各位高手指点一二
select @tran_name = 'students_delete'
@StuId = '2010121009'
begin tran @tran_namego
delete from dbo.Students where dbo.Students.cStudentsId = @StuId
go
delete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuId
go
delete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
go
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
go
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuId
go
delete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuId
go
delete from dbo.Education where dbo.Education.cStudentsId = @StuId
go
delete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId =--删除学生信息declare @tran_name varchar(30),@StuId char(10)
select @tran_name = 'students_delete'
@StuId = '2010121009'
begin tran @tran_namego
delete from dbo.Students where dbo.Students.cStudentsId = @StuId
go
delete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuId
go
delete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
go
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
go
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuId
go
delete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuId
go
delete from dbo.Education where dbo.Education.cStudentsId = @StuId
go
delete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId = @StuId
go
commite tran 'students_delete'go
commite tran 'students_delete'
各位,我要删除--删除学生信息declare @tran_name varchar(30),@StuId char(10)
select @tran_name = 'students_delete'
@StuId = '2010121009'
begin tran @tran_namego
delete from dbo.Students where dbo.Students.cStudentsId = @StuId
go
delete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuId
go
delete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
go
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
go
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuId
go
delete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuId
go
delete from dbo.Education where dbo.Education.cStudentsId = @StuId
go
delete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId = @StuId
go
commite tran 'students_delete'各位, 我要删除 @StuId = 2010121009的所有表中有关的行记录,但是执行的时候老是有 @StuId没有声明,那么声明该写在哪里呢,谢谢,各位高手指点一二
select @tran_name = 'students_delete'
@StuId = '2010121009'
begin tran @tran_namedelete from dbo.Students where dbo.Students.cStudentsId = @StuIddelete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuIddelete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuIddelete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuIddelete from dbo.Education where dbo.Education.cStudentsId = @StuIddelete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId = @StuIdcommite tran 'students_delete'
select @tran_name = 'students_delete'
@StuId = '2010121009'
begin tran @tran_namedelete from dbo.Students where dbo.Students.cStudentsId = @StuIddelete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuIddelete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuIddelete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuIddelete from dbo.Education where dbo.Education.cStudentsId = @StuIddelete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId = @StuIdcommite
as
begin
begin tran t1delete from dbo.Students where dbo.Students.cStudentsId = @StuIddelete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuIddelete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuIddelete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuIddelete from dbo.Education where dbo.Education.cStudentsId = @StuIddelete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId = @StuIdcommite tran 'students_delete'
endexec pr_name '2010121009'
declare @tran_name varchar(30),@StuId char(10)
select @tran_name = 'students_delete',
@StuId = '2010121004'
begin tran @tran_name
delete from dbo.Students where dbo.Students.cStudentsId = @StuId
delete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuId
delete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuId
delete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuId
delete from dbo.Education where dbo.Education.cStudentsId = @StuId
delete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId = @StuId
commit tran @tran_name
消息 547,级别 16,状态 0,第 6 行
DELETE 语句与 REFERENCE 约束"fkStuusers"冲突。该冲突发生于数据库"StudentsJobSystem",表"dbo.Stuusers", column 'cStudentsId'。这个又该怎么解决呢,谢谢……
select @tran_name = 'students_delete',
@StuId = '2010121004'
begin tran @tran_namedelete from dbo.StudentsSchool where dbo.StudentsSchool.cStudentsId = @StuId
delete from dbo.StuSchoolRewardPunish where dbo.StuSchoolRewardPunish.cStudentsId = @StuId
delete from dbo.Stuusers where dbo.Stuusers.cStudentsId = @StuId
delete from dbo.StudentContact where dbo.StudentContact.cStudentsId = @StuId
delete from dbo.ApplyJobInformation where dbo.ApplyJobInformation.cStudentsId = @StuId
delete from dbo.Education where dbo.Education.cStudentsId = @StuId
delete from dbo.IntroduceYourself where dbo.IntroduceYourself.cStudentsId = @StuId
---删除Students 放在后面
delete from dbo.Students where dbo.Students.cStudentsId = @StuId
commit tran @tran_name
这一段放在最后删除delete from dbo.Students where dbo.Students.cStudentsId = @StuId--
这一段放在最后删除delete from dbo.Students where dbo.Students.cStudentsId = @StuId--