我正在尝试从存储过程中返回datetime
变量
RETURN @StatusCode >returns string
IF(@LastConnected IS NOT NULL)
RETURN @LastConnected >returns datetime (Error!!) when
我删除了这一行,它执行得很好
答案 0 :(得分:0)
使用SELECT代替RETURN
CREATE PROCEDURE dbo.GetLastConnectedDate
--- INPUT PARAMETERS IF ANY
AS
BEGIN
SET NOCOUNT ON;
----- YOUR OTHER RELATED QUERIES
IF(@LastConnected IS NOT NULL)
SELECT @LastConnected ----- Use SELECT instead of RETURN here.
RETURN @StatusCode
END
GO