声明Datetime类型的变量后,查询结果成功。但是,我在最终阶段Tiger2徽标中收到以下错误。
“关键字附近的语法不正确'声明'原生错误:42000(156)”
代码如下。
DECLARE @Tarih1 DATETIME
DECLARE @Tarih2 DATETIME
SET @Tarih1 = Convert(DATETIME,'01.08.2011',104)
SET @Tarih2 = Convert(DATETIME,'30.09.2099',104)
SELECT
Convert(Varchar,PLN.DATE_,104) AS 'Vade_TARİHİ',
Convert(Varchar,PLN.PROCDATE,104) AS 'İşlem_TARİHİ',
PLN.PAYNO AS 'Ö.D.P.SATIR NO',
CL.TRANNO AS 'Fiş_No',
BANK.CODE AS BANKA_KODU,
BANK.DEFINITION_ AS BANKA,
HESAP.CODE AS HESAP_KODU,
HESAP.DEFINITION_ AS HESAP_AÇIKLAMASI,
CC.CODE AS Öğrenci_No,
CC.DEFINITION_ AS ÜNVANI,
PLN.TOTAL AS 'HS.Düşmesi_Gereken',
CL.AMOUNT AS 'POS_dan_Çekilen'
FROM LG_011_01_PAYTRANS AS PLN
JOIN LG_011_BANKACC AS HESAP ON HESAP.LOGICALREF=PLN.BANKACCREF
JOIN LG_011_BNCARD AS BANK ON BANK.LOGICALREF = HESAP.BANKREF
JOIN LG_011_CLCARD AS CC ON CC.LOGICALREF=PLN.CARDREF
LEFT OUTER JOIN LG_011_01_CLFLINE AS CL ON CL.LOGICALREF=PLN.FICHEREF
WHERE PLN.TRCODE=70 AND PLN.DATE_ BETWEEN @Tarih1 AND @Tarih2