Thursday, 4 October 2012

HEADER AND FOOTER


Product information is stored in table (Product_info). The product information I want to store it in a file, product wise. File should contain header (Product type is header) and footer (Total number of items is footer) shown below.

  
Source Table Script:

Create table Product_info
(
ID int,
Name varchar(20),
Type varchar(20),
Price decimal(8,4)
)

Source Data:

Insert into Product_info values(101,'Santoor','Soap',20)
Insert into Product_info values(102,'Margo','Soap',20)
Insert into Product_info values(103,'Sandel','Soap',25)
Insert into Product_info values(104,'Lux','Soap',35)
Insert into Product_info values(105,'Colget','Paste',20)
Insert into Product_info values(106,'Daber','Paste',15)
Insert into Product_info values(107,'Closeup','Paste',20)
Insert into Product_info values(108,'Parachoot','Hair oil',50)