Question : Declare variable in Microsoft SQL Server Management Studio

Hi all

How can I get this query below to use the variables
@F0_GgAb
@F1_GBis

Thanks in Advance
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
DECLARE 
@F0_GgAb	datetime,
	
@F1_GBis	datetime	
 
BEGIN
  SET @F0_GAb = 2008-10-22
  SET @F1_GBis = 2008-10-24
END
 
select * from T00 
WHERE (F20 = 101 AND 
F3 = '00150'  AND
GgAb = @F0_GAb
AND @F1_GBis)

Answer : Declare variable in Microsoft SQL Server Management Studio

Your names don't match.

DECLARE    @F0_GgAb
and
SET @F0_GAb

You also need quote marks around the dates '2008-10-22'

also check the SELECT statement - do you mean to use "BETWEEN @F0_GgAb AND @F1_GBis"   ?
Random Solutions  
 
programming4us programming4us