HOW TO CONVERT ORACLE FUNCTION TO SQL SERVER FUNCTION

Posted by Mark under Sql Server on 8/17/2010 | Points: 10 | Views : 5945 | Status : [Member] | Replies : 1
am a beginer in writing sql function. pls how can i convert the following code to sql server function. My main problem is convert rowtype in oracle to sql server .
pls i really need help on this: thanks in advance for helping me:
CREATE OR REPLACE FUNCTION ccsf_kri_assign (
classid IN INTEGER,
c_id IN INTEGER,
bt_start IN INTEGER,
ope IN INTEGER
)
RETURN INTEGER
IS
r_count INTEGER;
r_assign kri_assign%ROWTYPE;
BEGIN
IF (ope = 0)
THEN
RETURN 0;
END IF;

IF (ope != 4)
THEN
SELECT *
INTO r_assign
FROM kri_assign
WHERE common_id = c_id AND common_bt_start = bt_start;

SELECT COUNT (common_id)
INTO r_count
FROM kri
WHERE common_id = r_assign.id_kri
AND common_bt_stop = 2 AND ACTIVE = 1;

IF r_count = 0
THEN
RETURN 100000;
END IF;
END IF;

RETURN 0;
END;
/




Responses

Posted by: T.saravanan on: 9/27/2010 [Member] [MVP] Silver | Points: 25

Login to post response