title: SQL Server: how to create temp table with auto increment?
body: <p>I am trying to create a temp table with an auto increment and insert data. The table is created correctly, but I cannot import the data.</p>
  
  <p>If I just omit the ID table it works correctly, but I need to have the temp table have an ID that we can reference.  </p>
  
  <p>The errors I get are:</p>
  
  <blockquote>
    <p>Msg 4832, Level 16, State 1, Line 1<br>
    Bulk load: An unexpected end of file was encountered in the data file.</p>
    
    <p>Msg 7399, Level 16, State 1, Line 1<br>
    The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>SET @strFileName = 'file.txt';
  SET NOCOUNT OFF;
  
  CREATE TABLE #UUID
  (
        id INT NOT NULL IDENTITY PRIMARY KEY,
        cuuid NVARCHAR(50) COLLATE DATABASE_DEFAULT NULL
  );
  
  SET @strSQL = 'BULK INSERT #UUIDFROM ''' + @strFileName + ''' WITH (ROWTERMINATOR =''\n'' )';
  
  EXEC @intErr = sp_executesql @strSQL;
  </code></pre>
  
  <p>I wonder if it's trying to insert into the the id row instead of the cuuid row...</p>
  
  <p>Any ideas?</p>