use wroxdb
go
--
--   Name:  get_product
--
--   Description: get a single order record   
--
--
IF EXISTS (SELECT * FROM sysobjects WHERE name = 'get_product')
BEGIN
    DROP PROCEDURE get_product
END
GO
 
PRINT 'get_product'
GO
CREATE PROCEDURE get_product @prod_id int
AS
	select 	prod_id, 
		descr, 
		CONVERT(varchar(10),price) as price, 
		CONVERT(varchar(10),cost) as cost 
	FROM products as [product]
	WHERE prod_id = @prod_id
	FOR XML AUTO
GO
IF EXISTS (SELECT * FROM sysobjects WHERE name = 'get_product')
   PRINT  '>>> Created procedure get_product <<<'
GO

-- test
-- get_product 201

