title: why is CONVERT string to VARBINARY in SQL Server only converting first character?
body: <p>I am using NLog to log in my application and as part of that we are logging the customer number, which is a string in C#, and a varbinary(32) in the database. I am using the following SQL code for this specific parameter. The rest of the SQL statement works fine:</p>
  
  <pre><code>CONVERT(varbinary(32), @CustNumber)
  </code></pre>
  
  <p>and the following NLog parameter:</p>
  
  <pre><code>&lt;parameter name="@CustNumber" layout="${event-context:item=CustNumber}" /&gt;
  </code></pre>
  
  <p>and the following code in C# to add the Nlog parameter:</p>
  
  <pre><code>myEvent.Properties.Add("CustNumber", custNumber);
  </code></pre>
  
  <p>For some reason the value being stored in the actual table is only the first character of the original Customer Number string. I have double and triple checked to make sure I am not truncating the string before it is sent to the database. Any help would be greatly appreciated.</p>