Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
SQL
ALTER PROCEDURE [dbo].[ADMN_INSMAIN_FETCH]
    -- Add the parameters for the stored procedure here
    @P_Condition varchar ,@P_Mode varchar,@P_Entryby int
 ,@P_MAIN_INST_ID  int,@P_MAIN_INST_MAME varchar
AS
BEGIN
  if (@P_Condition='getmaster')
  begin
   select ADMN_INSTN_MASTER.*,ADMN_INSTN_MAIN.MAIN_INST_MAME from ADMN_INSTN_MASTER
             inner join ADMN_INSTN_MAIN on ADMN_INSTN_MAIN.MAIN_INST_ID=ADMN_INSTN_MASTER.MAIN_INST_ID ;
  end
END


This is my procedure. But the if condition is not working. What is the mistake.

pls help..
Posted
Comments
Maciej Los 24-Sep-13 7:45am    
How do you call this SP?
vineeth raju 24-Sep-13 7:51am    
i didnt understand. i am using C# language. do you mean that?
Maciej Los 24-Sep-13 7:52am    
Yes. How do you call this SP in your code behind?
Improve your question.
vineeth raju 24-Sep-13 7:56am    
Actually my c# side coding is perfect. I can execute this procedure, if condition is not their.
Maciej Los 24-Sep-13 8:03am    
My wife is perfect even if she kick me in the crotch ;)

1 solution

Got it! Use @P_Condition varchar(30) as parameter, because @P_Condition varchar represents only one character.
Have a nice day.

SQL
ALTER PROCEDURE [dbo].[ADMN_INSMAIN_FETCH]
    -- Add the parameters for the stored procedure here
    @P_Condition varchar(30) ,@P_Mode varchar,@P_Entryby int
 ,@P_MAIN_INST_ID  int,@P_MAIN_INST_MAME varchar
AS
BEGIN
  if (@P_Condition='getmaster')
  begin
   select ADMN_INSTN_MASTER.*,ADMN_INSTN_MAIN.MAIN_INST_MAME from ADMN_INSTN_MASTER
             inner join ADMN_INSTN_MAIN on ADMN_INSTN_MAIN.MAIN_INST_ID=ADMN_INSTN_MASTER.MAIN_INST_ID ;
  end
END
 
Share this answer
 
Comments
Maciej Los 24-Sep-13 15:48pm    
Hawk eye!
+5!

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