title: SQL Server permission to use the bulk load statement
body: <p>I have the below query which works fine in the SSMS. But when I include the same script as a job step, it fails with SQL permission to use the bulk load statement</p>
  
  <pre><code>DECLARE @FileContents  VARCHAR(MAX)
  
  DECLARE @filepath VARCHAR(1000)
  SET @FileContents = NULL
  
  SET @filepath ='C:\XXXX\6.0_Script_to a.sql'
  SET @FileContents = (SELECT BulkColumn 
                       FROM OPENROWSET (BULK 'C:\XXXX\6.0_Script_to a.sql', SINGLE_BLOB) a)   
  SET @FileContents = REPLACE(@FileContents, '[SQLSTATE 01000]', '') 
  SET @FileContents = REPLACE(@FileContents, 'Job ', '--Job ')
  SET @FileContents = REPLACE(@FileContents, ' GO ', CHAR(10) + ' GO ' + CHAR(10)) 
  SET @FileContents = REPLACE(@FileContents, 'Script ', '--Script ')
  
  PRINT @FileContents
  </code></pre>
  
  <p>But I have checked my credentials have bulkadmin permission and also executed the below query in server</p>
  
  <pre><code>EXEC master..sp_addsrvrolemember @loginame = N'xxxxxx', @rolename = N'bulkadmin'
  </code></pre>
  
  <p>Let us know what I need to include the script to be part of sqljob step</p>