Click here to Skip to main content
15,922,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear,
Please help me to get out from this problem.

SQL
FUNCTION Get_New_DISTRIBUTERID (a IN NUMBER)
   RETURN VARCHAR2
IS
   tmp_id   SM_DIVIDEND_BONUSDISTRIBUTER.DIVIDEND_DISTRIBUTER_ID%TYPE;
BEGIN
   SELECT   NVL (MAX (DIVIDEND_DISTRIBUTER_ID), TO_CHAR (SYSDATE, 'yymmdd') || '000000000000')
     INTO   tmp_id
     FROM   SM_DIVIDEND_BONUSDISTRIBUTER;

   IF SUBSTR (tmp_id, 1, 6) = TO_CHAR (SYSDATE, 'yymmdd')
   THEN
      RETURN TO_CHAR (tmp_id + 1, '000000000000000000');
   ELSE
      RETURN TO_CHAR (SYSDATE, 'yymmdd') || '000000000001';
   END IF;
END;



i need to convert in sql server 2005,it can be in sql function or procedure.

thanks in advance
Mahmud
Posted
Updated 17-Oct-11 1:36am
v2

1 solution

 
Share this answer
 
Comments
Mahmudunnabi 17-Oct-11 7:46am    
this link is not work

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