use wroxdb
go

--
--   Name:  get_employees
--
--   Description: get details of ALL employees
--
--
IF EXISTS (SELECT * FROM sysobjects WHERE name = 'get_employees')
BEGIN
    DROP PROCEDURE get_employees
END
GO
 
PRINT 'get_employees'
GO
CREATE PROCEDURE get_employees
AS

	SELECT '<employees>'
	
	SELECT emp_no, 
		name, 
		ltrim(str(commission_rate,6,4)) AS commission_rate
	FROM employees AS employee
	FOR XML AUTO
	
	SELECT '</employees>'
 
GO
IF EXISTS (SELECT * FROM sysobjects WHERE name = 'get_employees')
   PRINT  '>>> Created procedure get_employees <<<'
GO
