HW 05-09-2010 - END Declare @net decimal(18, 2) Insert into

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

View Full Document Right Arrow Icon
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))
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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

Page1 / 2

HW 05-09-2010 - END Declare @net decimal(18, 2) Insert into

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online