I have a view as shown below.The View is good running.When I attempt to run view,I got the following the error.What might the problem?
Incorrect syntax near the keyword 'Declare'
SQL Query:
create View [dbo].StokMaliyet
AS
Declare @Dolar decimal(18,3),@Euro decimal(18,3)
set @Dolar=(select Dolar from GunlukDoviz
set @Euro=(select Euro from GunlukDoviz)
select Stok_Kodu,
(case
when dovtip='3' then net_maliyet
when dovtip='2' then ((net_maliyet)*@Dolar)/@Euro
When dovtip='0' then (net_maliyet)/@Euro
end ) as Maliyet
from ib_mlyt