创建一存储过程,完成向课程表(C)中插入一条记录,记录值通过输入参数传递到存储过程中,并调用该存储过程
时间: 2023-06-29 09:10:46 浏览: 33
以下是一个示例存储过程,用于向课程表(C)中插入一条记录:
```
CREATE PROCEDURE InsertCourse
@courseId INT,
@courseName VARCHAR(50),
@department VARCHAR(50),
@teacherName VARCHAR(50)
AS
BEGIN
INSERT INTO C (CourseID, CourseName, Department, TeacherName)
VALUES (@courseId, @courseName, @department, @teacherName)
END
```
使用该存储过程的方法如下:
```
EXEC InsertCourse 101, 'Mathematics', 'Mathematics Department', 'John Doe'
```
该语句将向课程表中插入一条记录,ID为101,名称为“Mathematics”,所属部门为“Mathematics Department”,教师姓名为“John Doe”。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![bat](https://img-home.csdnimg.cn/images/20210720083646.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)