문제

I have a SQL Server stored procedure that is not returning any data when I plug in my parameter...

ALTER PROCEDURE dbo.EncumBugSearch 
@year datetime
AS
BEGIN

SET NOCOUNT ON;

    select *
From dbo.BudgetEncumberedTbl as bet
where year(dateadd(month,-3,bet.be_dateposted)) = @year
order by be_dateposted desc

END
GO

This returns nothing, however, when I plug in a number for the parameter (i.e. 2011) then I get the correct results... any ideas?

도움이 되었습니까?

해결책

Your parameter is a datetime, when it should be an int.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top