Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have written stored procedure like this...

Create proc SP_Sal_Select
@Designation varchar(20),
@Salary varchar(20)
as
declare @chk as varchar(20)
if exists(select *from Cus_Sal where Salary=@Salary and Designation=@Designation)
set @chk='Software Engineer'
else
set @chk='Non IT'
select @chk


Now i need to select salary>30000 ....
how to write the condition for above code...
Posted
Comments
King Fisher 21-Feb-14 0:05am    
you want to change this query?
select *from Cus_Sal where Salary=@Salary and Designation=@Designation)
set @chk='Software Engineer'
King Fisher 21-Feb-14 0:06am    
select *from Cus_Sal where Salary>@Salary and Designation=@Designation)
set @chk='Software Engineer'

user salary variable seems to be varchar change it to either Money or float
and change if statement

if exists(select *from Cus_Sal where Salary > @Salary and Designation=@Designation)
 
Share this answer
 
try this
replace this


if exists(select *from Cus_Sal where Salary=@Salary and Designation=@Designation)
with this

if exists(select *from Cus_Sal where Salary=@Salary and Designation=@Designation and Salary >30000)
 
Share this answer
 
v3

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