title: Msg 102, Level 15, State 1, Line 1 Incorrect syntax near 'D:'
body: <p>I trying to call a stored procedure:</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[uspImportDepartment2]
      @filePath nvarchar(255),
      @formatPath varchar(255),
      @countInsert Int OUTPUT
  AS
  BEGIN
      SET NOCOUNT ON;
  
      DECLARE @sqlstmt nvarchar(255)
      DECLARE @results table (result xml)
  
      --Build the Dynamic SQL Statement to get the data from the xml file
      SET @sqlstmt= N'SELECT * FROM OPENROWSET ( BULK ' + @filePath + ', FORMATFILE=''' + @formatPath + ''', FIRSTROW=1, MAXERRORS=0)AS xmlData'
  
      -- Insert the results of the dynamic SQL Statement into the temporary table variable.
      INSERT INTO @results EXEC (@sqlstmt)
  
      select @countInsert = count(*) from @results
  
      --DECLARE @xmlDoc XML
      --SELECT @xmlDoc = result FROM @results
  END
  GO
  </code></pre>
  
  <p>And execution code: </p>
  
  <pre><code>DECLARE @count1 int
  
  EXEC [dbo].[uspImportDepartment2] @filePath = 'D:\test_1.txt',
             @formatPath = 'D:\test_1_c.fmt', @countInsert = @count1 OUTPUT
  
  SELECT @count1 as AAAA
  </code></pre>
  
  <p>But it throws an error: </p>
  
  <blockquote>
    <p>Msg 102, Level 15, State 1, Line 1<br>
    Incorrect syntax near 'D:'.</p>
  </blockquote>
  
  <p>Can somebody tell me what the problem is? </p>
  
  <p>Thanks!</p>