title: How to convert when insert
body: <p>I want to insert some data to my database but I get an error</p>
  
  <p>This is table schema</p>
  
  <pre><code>ID int IDENTITY PRIMARY KEY,
  NAME varchar(100) NULL,
  TYPEID  int NULL,
  ISACTIVE bit NOT NULL,
  CREATEDDATE datetime NULL,
  CREATEDBY bigint NULL,
  MODIFIEDDATE datetime NULL,
  MODIFIEDBY bigint NULL
  </code></pre>
  
  <p>And this is the insert statement:</p>
  
  <pre><code>INSERT INTO SIZES 
  VALUES     
     (CONVERT(VARCHAR(20), 'S001'), 'S', '1', '01/12/2013', '1', '01/12/2013', '1'),
     (CONVERT(VARCHAR (20), 'S002' ), 'M', '1', '01/12/2013', '1', '01/12/2013', '1'),
     (CONVERT(VARCHAR (20), 'S003' ), 'L', '1', '01/12/2013', '1', '01/12/2013', '1'),
     (CONVERT(VARCHAR (20), 'S004' ), 'XL', '1', '01/12/2013', '1', '01/12/2013', '1'),
     (CONVERT(VARCHAR (20), 'S005' ), '36', '1', '01/12/2013', '1', '01/12/2013', '1'),
     (CONVERT(VARCHAR (20), 'S006' ), '37', '1', '01/12/2013', '1', '01/12/2013', '1'),
     (CONVERT(VARCHAR (20), 'S007' ), '38', '1', '01/12/2013', '1', '01/12/2013', '1')
  </code></pre>
  
  <p>And at the time the query runs into an error:</p>
  
  <blockquote>
    <p>Msg 245, Level 16, State 1, Line 1<br>
    Conversion failed when converting the varchar value 'S' to data type int.</p>
  </blockquote>