HW 05-09-2010

# HW 05-09-2010 - END [email protected] decimal(18 2 Insert into...

This preview shows pages 1–2. Sign up to view the full content.

Exercise 1 CREATE PROCEDURE Factorial(@Number Integer, @RetVal Integer OUTPUT) AS DECLARE @In Integer DECLARE @Out Integer IF @Number >= 0 BEGIN SELECT @In = @Number – 1 EXEC Factorial @In, @Out OUTPUT SELECT @RetVal = @Number * @Out END ELSE BEGIN print ‘Negative value found’ RETURN END Exercise II CREATE PROCEDURE Compute_Tax AS IF EXIST (Select * from sysobjects where name like ‘%TAX%’ and type = ‘T’) BEGIN CREATE TABLE TAX (SocialSecurityNo integer PRIMARY KEY, IncomeTax decimal(18, 2))

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: END Declare @net decimal(18, 2) Insert into Tax(SocialSecurityNo, IncomeTax) Select SocialSecurityNo, ( Set @net = (salary – (700 + no_of_dependents * 950) case when (@net > 30000) then (15000 * 10 /100) + 15000 * 15 /100) + (@net-30000)* 28/100 When (@net = 30000) then (15000 * 10 /100) + 15000 * 15 /100) When (@net > 15000 and @net < 30000) then (15000 * 10 /100) end ) From Employee...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

HW 05-09-2010 - END [email protected] decimal(18 2 Insert into...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online