Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
ALTER proc [dbo].[K_RT_GetRatebasedonmeat]
@partyname int,
@meattype int
as

begin


select case when PE.meattype<>(select meattype from K_RT_PartyNameYearly where partyname=@partyname) then 0  else isnull(PE.rateperkg,0) end as rateperkg from K_RT_PartyNameYearly PE
 inner join K_RT_PartyName PN on PE.partysno=PN.sno where PE.partysno=@partyname and PE.meattype=@meattype
 end




I wrote like this for my requirement but its not working properly. When i pass partyname and meattype as parameters, If "K_RT_PartyNameYearly" this table does not contain meattype for that partyname at that time I want to show 0 value.How can i write please help me.
Posted

1 solution

This will do:
SELECT COUNT(meattype) FROM K_RT_PartyNameYearly WHERE meattype=@meattype AND partyname=@partyname
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900