Question : date is incompatible with int

I get the error that date is incompatible with int, even I don't have any int-Format used in my procedure and the date-fields used in the source-tbl and the date-fields in the insert-tbl are both in date-Format. Any idea why and how to solve?
thx
Kongta
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
CREATE PROCEDURE sp_IndexChart
	(
	@von date,
	@bis date,
	@Index nvarchar(255),
	@UserName varchar(50)
	)
AS
BEGIN
SET NOCOUNT ON;

 
	--Delete
BEGIN   
	DELETE FROM tblIndexTmp WHERE UserName = @UserName
END

	--tblIndexTmp

	INSERT INTO tblIndexTmp
                      (Datum, MainIndex,Stand,UserName)
	SELECT     Datum,MainIndex,Stand, @UserName
	FROM         tblIndexArchiv
	WHERE      (Datum BETWEEN @von -1 AND @bis)

END

Answer : date is incompatible with int

Try change the where clause from this:

        WHERE      (Datum BETWEEN @von -1 AND @bis)

to this:

        WHERE      (Datum BETWEEN dateadd(dd, -1, @von) AND @bis)

Random Solutions  
 
programming4us programming4us