Srored Procedure Error [Resolved]

Posted by Raj.Trivedi under Sql Server on 11/20/2014 | Points: 10 | Views : 1273 | Status : [Member] [MVP] | Replies : 2
I am getting the following error when i trying to create the store procedure

Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

create proc GetDiscountforClient
(
@ClientId int
)
as
begin
declare @RowTransactionCount int;
declare @DiscountValue decimal(18,2);
set @RowTransactionCount = (Select Count(ClientId) from TransactionDetail where
ClientId = @ClientId)
if(@RowTransactionCount > 5)
begin
set @DiscountValue = (select DV.ActualValue,DV.DiscountId,DM.DiscountType
from DiscountValue DV
inner join DiscountMaster DM
on
DV.DiscountId = DM.DiscountId
where DV.DiscountId = 1)
end
select @DiscountValue 'DiscountValue'
end

Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved



Responses

Posted by: Bandi on: 11/21/2014 [Member] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
create proc GetDiscountforClient 
(
@ClientId int
)
as
begin
declare @RowTransactionCount int;
declare @DiscountValue decimal(18,2);
set @RowTransactionCount = (Select Count(ClientId) from TransactionDetail where
ClientId = @ClientId)
if(@RowTransactionCount > 5)
begin
SELECT @DiscountValue = DV.ActualValue from DiscountValue DV
inner join DiscountMaster DM on DV.DiscountId = DM.DiscountId
where DV.DiscountId = 1)
end
select @DiscountValue 'DiscountValue'
end


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Raj.Trivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Goud.Kv on: 11/22/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
Good one Bandi...

Thanks & Regards,
Krishna

Raj.Trivedi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response