Click here to Skip to main content
15,919,778 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dear Expert,

need to convert the following codes to a stored procure in ms sql server from an earlier programming language .

SQL
PRIVATE MCNT,MRCNT,MROWS,COLMS
MROW6=0
COLMS=0
MCNT=0
MRCNT=0

SELECT vTaxvalue
GO TOP
COUNT TO MROWS

COLMS=6

DECLARE  TAXARR[MROWS,COLMS]

MCNT=1
SELECT vTaxvalue
GO TOP

MCNT=1

DO WHILE  MCNT<=MROWS   

	TAXARR[MCNT,1]=BAND
	TAXARR[MCNT,2]=VALUE
	TAXARR[MCNT,3]=RATE

	MCNT=MCNT + 1
	SKIP

ENDDO


MRCNT=1

DO WHILE MRCNT <= MROWS
	
	IF MRCNT=1
		TAXARR[MRCNT,4]=TAXARR[MRCNT,2]
		ELSE
		TAXARR[MRCNT,4]=TAXARR[MRCNT-1,4]+TAXARR[MRCNT,2]
	ENDIF


	TAXARR[MRCNT,5]=(TAXARR[MRCNT,4])/12

	IF MRCNT =1
		TAXARR[MRCNT,6]=0
		ELSE
		TAXARR[MRCNT,6]=(TAXARR[MRCNT,3]/100)*(TAXARR[MRCNT,5]-TAXARR[MRCNT-1,5])+TAXARR[MRCNT-1,6]
	ENDIF
	
	MRCNT=MRCNT+1

ENDDO



Essentially the program does the following computation


BAND NO AMOUNT RATE (%) CUMULATIVE AMOUNT COMPUTATION
--------------------------------------------------------------------
101      100     0            100           0 ==0
102      200     5            300          (300-100)*(5/100) + 0  == 10 
103      250    10            550          (550-300)*(10/100)+ 10 == 35
104      350    20            900          (900-550)*(20/100)+ 35 ==105


How do you perform this function in ms sql server 2008 as a stored procedure
or in C#.

Thanks

What I have tried:

LOOKED AT OTHER PROGRAMS AND THE INTERNET BUT TO NO AVAIL
Posted
Updated 2-Jul-16 20:19pm
v4

1 solution

It doesn't quite work like that.
We are not a code writing service; we do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.
But be aware: you get what you pay for. Pay peanuts, get monkeys.

Alternatively, learn the "earlier programming language" and either C# or SQL and do it yourself.
 
Share this answer
 
Comments
Member 10744248 3-Jul-16 1:41am    
Thanks this were codes I wrote in visual foxpro 6 . 20 years ago
Patrice T 3-Jul-16 2:25am    
Use Improve question to update your question.
So that everyone can pay attention to this information.
Patrice T 3-Jul-16 2:30am    
May be the easiest is to update to last incarnation of VF which is about 2008 if I remember.

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