title: Bulk insert using stored procedure
body: <p>I have a query which is working fine:</p>
  
  <pre><code>BULK INSERT ZIPCodes 
  FROM  'e:\5-digit Commercial.csv' 
  WITH 
  ( 
       FIRSTROW = 2 ,
      FIELDTERMINATOR = ',', 
      ROWTERMINATOR = '\n' 
  )
  </code></pre>
  
  <p>but now I want to create a stored procedure for it.</p>
  
  <p>I have written below code to make its stored procedure:</p>
  
  <pre><code>create proc dbo.InsertZipCode
  @filepath varchar(500)='e:\5-digit Commercial.csv'
  as
  begin
  BULK INSERT ZIPCodes 
  FROM  @filepath 
  WITH 
  ( 
       FIRSTROW = 2 ,
      FIELDTERMINATOR = ',', 
      ROWTERMINATOR = '\n' 
  )
  end
  </code></pre>
  
  <p>but its showing error:</p>
  
  <blockquote>
    <p>Msg 102, Level 15, State 1, Procedure
    InsertZipCode, Line 6 Incorrect syntax
    near '@filepath'.</p>
    
    <p>Msg 319, Level 15, State 1, Procedure
    InsertZipCode, Line 7 Incorrect syntax
    near the keyword 'with'. If this
    statement is a common table
    expression, an xmlnamespaces clause or
    a change tracking context clause, the
    previous statement must be terminated
    with a semicolon.</p>
  </blockquote>
  
  <p>Please tell me what I am doing wrong and what I can do to make it work in stored procedure.</p>
  
  <p>Thanks</p>