title: The data types varchar and varbinary(max) are incompatible in the add operator
body: <p>I am trying to insert into a FileTable using a stored procedure where my FileStream, FileName, FilePath will be parametrized. I have tried this but it throws an error </p>
  
  <blockquote>
    <p>The data types varchar and varbinary(max) are incompatible in the add operator</p>
  </blockquote>
  
  <p>My stored procedure:</p>
  
  <pre><code>    @filePath VARCHAR(100),
      @fileName VARCHAR(100)
  AS
  BEGIN
      DECLARE @file VARBINARY(MAX)
      DECLARE @sql NVARCHAR(max)
  
      SET @sql = 'SELECT'+ @file +' = CAST(bulkcolumn AS VARBINARY(MAX)) FROM OPENROWSET(BULK '+ @filePath +', SINGLE_BLOB) AS x'
  
      EXEC(@Sql);
  
      INSERT INTO dbo.FileStore(name, file_stream)
          SELECT @fileName, @file
  END
  </code></pre>