title: SQL Server output to a file using variable name
body: <p>I want to send SQL Server output to a file which is working as expected. But if I pass the file path in a variable, It is not creating the file.</p>
  
  <p>Working</p>
  
  <pre><code>:out 'C:\Temp.txt'
  </code></pre>
  
  <p>Not Working</p>
  
  <pre><code>DECLARE @BCVFileName VARCHAR(500)
  SET @BCVFileName= 'C:\Temp.txt'
  
  :out @BCVFileName
  </code></pre>
  
  <p>Could anyone please help me on this??</p>
  
  <p>Thanks,
  Mahesh</p>