出处:http://www.jb51.net/article/54730.htm
--有输入参数的存储过程--create proc GetComment(@commentid int)asselect * from Comment where CommentID=@commentid --有输入与输出参数的存储过程--create proc GetCommentCount@newsid int,@count int outputasselect @count=count(*) from Comment where NewsID=@newsid--返回单个值的函数--create function MyFunction(@newsid int)returns intasbegindeclare @count intselect @count=count(*) from Comment where NewsID=@newsidreturn @countendMyFunction 1--返回值为表的函数--Create function GetFunctionTable(@newsid int)returns tableasreturn(select * from Comment where NewsID=@newsid) 调用方式:select * from GetFunctionTable(2)原文:http://www.cnblogs.com/it12345/p/5199029.html