我想建个存储过程
想输出一段时间内的记录:
create PROCEDURE GetVisitorsByYear
@Date varchar(50)
AS
BEGIN
SET NOCOUNT ON;
select * from VisitLog where VisitDate between @Date and @Date.year()+1
SET NOCOUNT Off;
END
------解决方案--------------------
- SQL code
select * from VisitLog where VisitDate between @Date and dateadd(year,@Date,1)
------解决方案--------------------
- SQL code
create PROCEDURE GetVisitorsByYear @Date varchar(50) AS BEGIN SET NOCOUNT ON; select * from VisitLog where VisitDate between @Date and dateadd(year,1,@Date)SET NOCOUNT Off; END
------解决方案--------------------
exec GetVisitorsByYear '2008-01-01'