我有这样的存储过程:
alter procedure [dbo].[testdate]
as
begin
declare @current nvarchar(100),
@date1 datetime
select @current = getdate()
select @date1 = getdate()
end
执行时我想显示@current
和@date1
..
如何声明这两个变量?
现在我收到0
答案 0 :(得分:3)
BEGIN
DECLARE @curent nvarchar(100),
@date1 datetime
SELECT @curent=getdate()
SELECT @date1=getdate()
SELECT @curent
SELECT @date1
END
答案 1 :(得分:1)
您应该使用OUTPUT keyword从存储过程中获取这些值
declare
@curent nvarchar(100) OUTPUT,
@date1 datetime OUTPUT
答案 2 :(得分:1)
试
alter procedure [dbo].[testdate] as
begin
declare
@curent nvarchar(100),
@date1 datetime
select @curent=getdate()
select @date1=getdate()
select @curent as "CurrentDate"
select @date1 as "Date1"
end