CREATE PROCEDURE [dbo].[GetNameById] @studentid varchar(8), @studentname nvarchar(50) OUTPUT AS BEGIN SELECT @studentname=studentname FROM student WHERE studentid=@studentid if @@Error<>0 RETURN -1 else RETURN 0 END using (SqlConnection conn = new S…
CREATE PROCEDURE [dbo].[GetNameById] @studentid varchar(), @studentname nvarchar() OUTPUT AS BEGIN SELECT @studentname=studentname FROM student WHERE studentid=@studentid RETURN - else RETURN END using (SqlConnection conn = new SqlConnection(connStr)…
在sql server中建存储过程,如果需要参数是一个可变集合的处理 原存储过程,@objectIds 为可变参数,比如 110,98,99 ALTER PROC [dbo].[Proc_totalScore] @categoryKey int, @objectIds VARCHAR(MAX) AS BEGIN SELECT c.Name,AVG(e.Score) Score FROM dbo.Sys_com_comment_main m INNER JOIN dbo.sys…