0

while sending request parameter to this stored procedure
i need to insert an department _id ,fy_id, vertical_id , while inserting .Before that i set one temp int variable and then assign it to query
And checking the condition of temp variable if temp variable is 0 then could not only value isto be inserted

ALTER PROCEDURE [dbo].[insert_approved_man_power](
@fy_id INT ,
@department_id INT ,
@approved_man_power INT,
@login_id nchar(10),
@login_dt smalldatetime ,
@vertical_id INT)

AS 
declare @temp  int

set @temp = 0

set @temp = select department_id from approved_man_power where department_id != @department_id  and fy_id != @fy_id and  vertical_id != @vertical_id 

if @temp = 0

BEGIN

INSERT INTO approved_man_power(fy_id,department_id,approved_man_power,login_id,login_dt,vertical_id)
	 VALUES (@fy_id,@department_id ,@approved_man_power,@login_id,@login_dt,@vertical_id) 
END
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by urtrivedi
0

i am changing your line no 14 and 16

SET @temp = SELECT count(*) FROM approved_man_power WHERE department_id = @department_id  AND fy_id= @fy_id AND  vertical_id = @vertical_id  

IF isnull(@temp,0) = 0

Do not post your probles in code snippet. Post it as Forum Thread.

Edited by urtrivedi: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.