这些是表格和编码。
create table student
(
s_id varchar(10) unique,
s_name varchar(50),
s_report varchar(50),
)
create table student_contact
(
stid int identity primary key,
stcellphone varchar(50) unique,
s_id varchar(10),
foreign key(s_id) references student(s_id)
)
create table test
(
t_id int identity primary key,
t_marks int,
)
create table st_test
(
stt_id int identity primary key,
s_id varchar(10),
t_id int,
foreign key(s_id) references student(s_id),
foreign key(t_id) references test(t_id)
)
alter view [join]
as
select s1.s_name,s2.stcellphone,s4.t_marks,s1.s_report
from
student as s1
inner join
student_contact as s2
ON s1.s_id=s2.s_id
inner join
st_test s3
ON s1.s_id=s3.s_id
inner join
test as s4
ON s4.t_id=s3.t_id
alter procedure marks
@st_id varchar(10)='',
@name varchar(50)='',
@mobile varchar(50)='',
@marks int=''
as
begin
if(@marks < 3)
begin
insert into student values(@st_id,@name,'You are enrolled for 6 months')
insert into test values(@marks)
insert into student_contact values(@mobile,@st_id)
select * from [join] where s_name =@name
end
end
这是我创建的编码我已经创建了一个插入数据的过程现在我希望在“st_test”表中有2个列名是(s_id,t_id),它们是对学生和测试表的引用现在问题是我已经创建这些表是连接的视图,并且该视图已在过程中使用,问题在于过程中我希望当我填写所有参数时,我将根据条件看到插入的表。