title: does SQL Server consider culture/locale when converting values to/from strings?
body: <p>I'm attempting to update a large codebase to properly specify the <code>CultureInfo</code> and/or <code>IFormatProvider</code> when formatting/parsing values. For instance, when parsing a value I get from the user, I pass <code>CultureInfo.CurrentCulture</code> when calling <code>TryParse</code>, and when converting a float to a string for persistence, I pass <code>CultureInfo.InvariantCulture</code> when calling <code>ToString</code>.</p>
  
  <p>My question is this: when generating SQL queries, should I format numbers and the like using the invariant culture, or the SQL server's culture, or what? Which is to say, if my computer is set to German (Germany), which of these queries is right?</p>
  
  <pre><code>select foo from bar where baz = 123.45
  </code></pre>
  
  <p>or </p>
  
  <pre><code>select foo from bar where baz = 123,45
  </code></pre>
  
  <p>Likewise, if I use SQL's <code>CAST</code> to convert a floating-point value to a string, what locale is SQL going to use for the conversion?</p>
  
  <p>I did search the SQL docs, but so far I can't find any good answers. I did find some info about date formatting (SET DATEFORMAT and the like), but that's it.</p>
  
  <p><strong>NOTE</strong>: I realize that the preferred way to pass inputs to a SQL query is via parameters, so let's assume for argument's sake that I have a good reason to format them into the query string. Also, handing query inputs is only part of the broader question.</p>