Reputation: 43
I have two views like below
create view penord1_view
as
select
ser, docno, pcode, barcode, pname, unid, unit, qty, rate
from
sale
where
tc = 'O01' and docdt > @xdate1 and docdt < @xdate2
union
select
sser as ser, sdocno as docno, pcode, barcode, pname, unid, unit, qty, rate
from
sale
where
tc = 'P01' and docdt > @xdate1 and docdt < @xdate2
and the second one is
create view penord_view
as
select
ser, docno, pcode, barcode, pname, unid, unit, rate,
SUM(qty) AS qty
from
penord1_view
group by
ser, docno, pcode, barcode, pname, unid, unit, rate
The problem is that I cannot pass @xdate1
parameter in the first view.
Please suggest how to do this in a view or in some other way in SQL Server
Upvotes: 0
Views: 138
Reputation: 747
A view has no parameters by definition. You can see it as a saved query. If you would like to use parameters you should look into using stored procedures.
Upvotes: 1