use wroxdb
go
--
--   Name:  get_order
--
--   Description: get a single order header record   
--
--
IF EXISTS (SELECT * FROM sysobjects WHERE name = 'get_order')
BEGIN
    DROP PROCEDURE get_order
END
GO
 
PRINT 'get_order'
GO
CREATE PROCEDURE get_order @ord int
AS
	SELECT xact='-',
		order_no, 
		CONVERT (char(10),order_date,126) as order_date, 
		emp_no, customer, deliver, 
		CONVERT(varchar(10),shipping_charge) AS shipping_charge, 
		CONVERT (char(10),ship_date,126) AS ship_date,
		adm_rev_no, CONVERT(varchar(20),adm_time, 113) AS adm_time
	FROM orders AS [order]
	WHERE order_no = @ord
	FOR XML AUTO
GO
IF EXISTS (SELECT * FROM sysobjects WHERE name = 'get_order')
   PRINT  '>>> Created procedure get_order <<<'
GO

-- test
-- get_order 1000
