title: Cast / Convert a Text column to String while creating a VIEW in SQLite
body: <p>I need to cast a field while creating a VIEW of a table in a SQLite database:</p>
  
  <p>A basic example would be:</p>
  
  <p>Table1 {
  field1 TEXT,
  field2 TEXT,
  ... }</p>
  
  <pre><code>CREATE VIEW ViewFromTable as SELECT field1, cast (field2 as INTEGER) as fieldConverted  from Table1
  </code></pre>
  
  <p>where field2 is a TEXT column 
   I want to convert its content in the column fielConverted as INTEGER.</p>
  
  <p>My real query has a case expresion as follows:</p>
  
  <pre><code>CREATE VIEW ViewFromTable AS
  SELECT field1, 
  CASE
  WHEN field2 == "case1" THEN 1
  WHEN field2 == "case2" THEN 2
  ELSE 3
  END
  as fieldConverted 
  FROM Table1
  </code></pre>
  
  <p>However, I get that Type of the column in the VIEW is TEXT for the column fieldConverted and I want it to be INTEGER</p>
  
  <p>Any idea about the sintaxis with my query? Any other way to do this conversion? Is this possible?
  Thanks in advance </p>