sql-server – SQL Server:如何创建存储过程
发布时间:2020-12-12 08:33:20 所属栏目:MsSql教程 来源:网络整理
导读:我正在从书中学习sql,我正在尝试编写一个存储过程,但我不相信我正在做这个.以下方式在Microsoft SQL中无效?如果没有,什么时候有效,如果有的话? create procedure dept_count(in dept_name varchar(20),out d_count integer) begin select count(*) into d_c
我正在从书中学习sql,我正在尝试编写一个存储过程,但我不相信我正在做这个.以下方式在Microsoft SQL中无效?如果没有,什么时候有效,如果有的话?
create procedure dept_count(in dept_name varchar(20),out d_count integer) begin select count(*) into d_count from instructor where instructor.dept_name=dept_count.dept_name end 我收到以下错误
解决方法T-SQL/* Stored Procedure GetstudentnameInOutputVariable is modified to collect the email address of the student with the help of the Alert Keyword */ CREATE PROCEDURE GetstudentnameInOutputVariable ( @studentid INT,--Input parameter,Studentid of the student @studentname VARCHAR (200) OUT,-- Output parameter to collect the student name @StudentEmail VARCHAR (200)OUT -- Output Parameter to collect the student email ) AS BEGIN SELECT @studentname= Firstname+' '+Lastname,@StudentEmail=email FROM tbl_Students WHERE studentid=@studentid END (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |