请教:sql查询
我想建个存储过程
想输出一段时间内的记录:
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
[解决办法]
select * from VisitLog where VisitDate between @Date and dateadd(year,@Date,1)
[解决办法]
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'