存储过程示例 [英] Stored Procedure Example
本文介绍了存储过程示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我是Sql Server 2005的新手,谁能告诉我返回DateTime值的存储过程的示例.
Hello There, I am New To Sql Server 2005, Can AnyOne Tell Me the Example of Stored Procedure That Returns The DateTime Value.
Create Proc MyProc
AS
DECLARE @dt DateTime
SELECT @dt =GetDate()
Return @dt
----------------------------------
我想将@dt
存储在其他变量中
----------------------------------
I Want to Store The @dt
In a Different Variable
DECLARE @Result Datetime
SET @Result=@dt
是否可以将存储过程的结果存储在变量中
问候.
Is It Possible to Store The Result Of Stored Procedure in A Variable
Regards.
推荐答案
尝试此
try this
Create Proc MyProc
AS
DECLARE @dt DateTime
set @dt =GetDate()
select @dt as CurrentDatetime
您可以使用OUTPUT参数从存储过程中返回值.检查以下链接.
http://sqlserverpedia.com/wiki/Stored_Procedures_-_Output_Parameters_%26_Return_Values [
You can use OUTPUT parameter to return values from a stored procedure. Check the below link.
http://sqlserverpedia.com/wiki/Stored_Procedures_-_Output_Parameters_%26_Return_Values[^]
这篇关于存储过程示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文