Gespeicherte Prozedur einmal mit, einmal ohne WHERE-Klausel

You could use a simple if statement in the stored procedure:

Declare @Param varchar(3)
Set @Param = ' '

If @Param =' '
Select * from Products
Else
Select * from Products WHERE (ProductID = @Param)

1 Stern2 Sterne3 Sterne4 Sterne5 Sterne

Loading…
Avatar von manuel

AUTOR

manuel