title: Stored procedure for counting file types
body: <p>I have table called tbl_upload which stores the data of uploaded file into it, with the columns of Filename, filetype, filesize, serial etc.</p>
  
  <pre><code> | FileName|Filetype|Filesize|Serial|
   |    a    | doc    |   1232 |  1   |
   |    b    | txt    |   1232 |  2   |
   |    c    | pdf    |   321  |  4   |
   |    d    | xls    |    41  |  5   |
   |    e    | rtf    |    23  |  6   |
  </code></pre>
  
  <p>like this so on.....</p>
  
  <p>There might be file types of around 8 to 10 including odt, html, xml etc...</p>
  
  <p>On a page i would like to show all of types in a graph using jqxChart, which need its data source in 'json'or 'array'or 'xml' types.
  So i need to get the total no.of doc files, total no.of txt files, no.of rtf etc ..
  I wrote a SP as</p>
  
  <pre><code>       ALTER proc [dbo].[GetFiles] @Pdf int out, @doc int out, @odt int out, @txt int  out
      as
      begin
      select @Pdf= COUNT (*)  from tbl_Uploads where Filetype='xml' 
      select @doc=COUNT (*)  from tbl_Uploads where Filetype='doc'
      select @txt=COUNT (*)  from tbl_Uploads where Filetype='txt'
      select @odt=COUNT (*)  from tbl_Uploads where Filetype='odt'
     ...so on
  
  
  end
  </code></pre>
  
  <p>Is this a good approach or is there any better ways than this?? I just want total no. of each file type...</p>