如果创建的日期时间是空的或没有值,我想返回整个表。如果它包含日期,我想返回表格数据大于那个日期。在这里下面我提交一个代码,但它提供数据时,有一个参数,但它显示这样的错误过程SelectRotarian_AllByCreatedDatetime
程序或功能SelectRotarian_AllByCreatedDatetime
预计参数@createdDateTime
,这是没有提供。传递null参数时出错
(1行(S)的影响)
ALTER PROCEDURE [dbo].[SelectRotarian_AllByCreatedDatetime]
@createdDateTime varchar(50)
AS
BEGIN
SET NOCOUNT ON;
if (Coalesce(@createdDateTime,'') = '')
begin
select [id]
,[surName]
,[firstName]
,[secondName]
, [address]
, [gender]
,[picture]
,[email]
,[phoneNumber]
,[DOB]
,[vocation]
,[bloodGroup_id]
,[club_id]
,[createdDateTime]
FROM [rotary_rotarian]
end
else
begin
SELECT[id]
,[surName]
,[firstName]
,[secondName]
, [address]
, [gender]
,[picture]
,[email]
,[phoneNumber]
,[DOB]
,[vocation]
,[bloodGroup_id]
,[club_id]
,[createdDateTime]
FROM [rotary_rotarian]
where [createdDateTime] > CAST(@createdDateTime AS DateTime)
end
END
所以请帮我
感谢ü这么多。现在它正在工作。你的巨大帮助... –