SQL server - Insert string record containing backslash
<p>I'm trying to insert a record in the table where one of the column has following value.</p>

<p><code>\\\\a\\b\\c</code></p>

<pre><code>Database DataProvider = new SqlDatabase(connectionstring);  
DataProvider.ExecuteNonQuery("sprocname",
                    Id,
                    qText,
                );  
</code></pre>

<p>Here, <code>qText</code> has above value. After execution, the value gets added in the table as <code>\</code> (single backslash) only.</p>

<p>If I try to insert the record manually in the table, </p>

<pre><code>INSERT INTO mytbl(id, q) VALUES
 (0, '\\\\a\\b\\c')
</code></pre>

<p>proper value gets inserted. Any reason why this is happening? Am I missing anything here?</p>

<p><strong>UPDATE</strong></p>

<p>It seems that whatever my string is, only it's first letter getting inserted in that column! Not sure why. The datatype of the column is <code>varchar(max)</code></p>

<p>Ex. </p>

<pre><code>for qText = 'abc', then column has value `a`
for qText = '\\\\a\\b\\c', then column has value `\`
</code></pre>