MSSQL存储过程的用法:基础

创建存储过程的基本格式:

Create procedure update_createtime
@tbID int
as
    update t_member set createTime = GetDate() where tbID = @tbID
go

添加返回值时就可以这样做

--Developer:zhihui Zhou
--Date:New()as 2008-10-18
--Email:zhou5791759@163.com
--QQ:297510342

Create procedure update_createtime
@tbID int,
@createTime nvarchar(50) output
as
    update t_member set createTime = GetDate() where tbID = @tbID
    set @createTime = (select createTime from t_member where tbID = @tbID)
go

执行这个存储过程:

--Call SQL in the method for
--start
declare @createTime nvarchar(50)
exec update_createTime 1,@createTime output
--end

来源:http://www.cnblogs.com/zhou5791759/archive/2008/10/19/1314292.html

updatedupdated2023-12-062023-12-06