Extreme Veteran
Beiträge: 568
| Hallo,
pwakolbi - 02.07.19 17:38
ALTER Proc [dbo].[spSuchenAngebot]
......
@DatumVon date = Null,
@DatumBis Date = Null,
......
as
SELECT
.....
Datum,
.....
FROM dbo.tblAngebot INNER JOIN
dbo.tblKundenAdressen ON
dbo.tblAngebot.Kundennummer = dbo.tblKundenAdressen.Adressnummer
WHERE
......
AND (isNull(@Datumvon,'19000101') IS NULL oR
Datum >= @DatumVon)
AND (isNull(@DatumBis,'29001231') IS NULL OR
Datum <= @DatumBis)
.....
Probier mal so:
WHERE Datum >= CASE WHEN @Datumvon IS NULL THEN '19000101' ELSE @Datumvon END
AND Datum <= CASE WHEN @Datumbis IS NULL THEN '29001231' ELSE @Datumbis END
----- Gruss - Peter |