CREATE TABLE #GetCon
(
id INT IDENTITY(1,1) PRIMARY KEY,
con1 INT NULL,
con2 INT NULL,
value numeric(13,2) NULL
)
INSERT INTO #GetCon
(con1, con2, value)
VALUES(70,80,10),
(81, 104,15),
(105,114,25),
(115,129,30),
(120,150,40),
(150, 170, 50)
DECLARE @con1 INT,
@con2 INT,
@value numeric(13,2)
SET @con1 = 70
SET @con2 = 80
SET @value = (SELECT value FROM #GetCon
WHERE con1 >= @con1 and con2 <= @con2)
create table #employee_cash_incentive
(
inv_no varchar(20),
acc_code varchar(20),
creation_date datetime,
agent_name varchar(80),
amount numeric(13,2),
amount_out numeric(13,2),
net_amount numeric(13,2),
inv_status varchar(30),
acc_name varchar(150),
Supervisor_name varchar(140),
call_count int,
sale_count int,
organisation varchar(300),
service_amount_in numeric(13,2),
service_amount_out numeric(13,2),
product_amount_in numeric(13,2),
product_amount_out numeric(13,2),
hosting_amount_in numeric(13,2),
hosting_amount_out numeric(13,2),
target_amount numeric(13,2),
salary numeric(13,2),
RPC numeric(13,2),
Con numeric(13,2),
Final_Payment numeric(13,2),
cal numeric(13,2),
cal_rs numeric(13,2),
Released_final_amount numeric(13,2)
)
INSERT INTO #employee_cash_incentive
(inv_no,Supervisor_name,call_count,Con)
VALUES('1','Jim Smith',5,@value)
SELECT inv_no,Supervisor_name,call_count,Con FROM #employee_cash_incentive
DROP TABLE #employee_cash_incentive
DROP TABLE #GetCon