title: How do you handle casting problems using OPENROWSET?
body: <p>I am trying to use a txt file that contains only keys in a sql query.</p>
  
  <pre><code>SELECT
  *
  FROM
  MyTable
  JOIN
  OPENROWSET (
           BULK '&lt;File-Of-Ids&gt;.txt',
           FORMATFILE = '&lt;Format-File&gt;.txt'
  ) B ON MyTable.Id  = B.Id
  WHERE 
  &lt;a field&gt; = &lt;a value&gt; AND &lt;another field&gt; = &lt;another value&gt;
  </code></pre>
  
  <p>But I'm getting the following error: Error converting datatype nvarchar into bigint.</p>
  
  <p>Seems obvious to me that some casting needs to be done on the input from the file. Can anybody point me in the right direction? Thanks in advance!</p>