ich möchte Suchbegriff Abfrage akzeptieren Parameter von asp.net Web-AnwendungSQL wo mit zwischen Klausel über col Typ Datum
wenn @firstName richtig mit zwischen Klausel
create proc test
@From Datetime,
@to Datetime,
@firstName varchar(50)
as
begin
select * from Employee
where Empfname=(case when @firstName != '' then @firstName else Empfname end)
and 1=(case when @From != null and @From != '' and @to != null and @to != ''
then EmpJoinDate between @From and @to else 1 end) end
Verwenden Sie nicht 'case' in der where-Klausel, wechseln Sie stattdessen zu' and'/'or'. (Etwas wie 'where (@firstName = '' oder @firstName = Empfname) ....) – jarlh