SQL存储过程的用法:基础

现在做程序员,发现我老是喜欢忘记前段时间运用的东西,不知道是因为每天的工作内容太杂了还是自身的原因。

 嗨。。。。没办法,只要吧自己长期喜欢忘记的东西记录下来。

存储过程只是我的这个计划的开始,哈哈

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

ContractedBlock.gif ExpandedBlockStart.gif Code
--Developer:zhihui Zhou
--
Date:New()as 2008-10-18
--
Email:zhou5791759@163.com
--
QQ:297510342
--
create time to update 

Create procedure update_createtime

@tbID int

as

    
update t_member set createTime = GetDate() where tbID = @tbID

go

 

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

 

ContractedBlock.gif ExpandedBlockStart.gif Code
--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

 

 

 

转载于:https://www.cnblogs.com/zhou5791759/archive/2008/10/19/1314292.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值