title: Powershell, Invoke-SqlCmd: How to get all the data from a column
body: <p>I have a table that has a column containing JSON data.  It can be fairly large.  I want to run a query to select the JSON data from a single row, using PowerShell.  The command looks like this:</p>
  
  <pre><code>Invoke-Sqlcmd -ServerInstance xxxxxx 
    -Database xxxxxx -Username xxxxxx -Password xxxxxx 
    -Query 'select [data] from jsontable where versionid=1922' 
    -MaxCharLength 700000 | Out-File .\my.json
  </code></pre>
  
  <p>The command works, but the result is only a small portion of the whole.  e.g. in the output file I see:</p>
  
  <pre><code>data                                                                                                                                                                                                                              
  ----                                                                                                                                                                                                                              
  {"$type":"System.Collections.Generic.List`1[[TBSM.Vision.FpFtp.Common.Domain.Data.FeedDerivedAttributeRuleData, TBSM.Vision.FpFtp.Common.Domain.Data]], mscorlib","$values":[{"$type":"TBSM.Vision.FpFtp.Common.Domain.Data.Fee...
  </code></pre>
  
  <p>but the data actually begins:</p>
  
  <pre><code>{"$type":"System.Collections.Generic.List`1[[TBSM.Vision.FpFtp.Common.Domain.Data.FeedDerivedAttributeRuleData, TBSM.Vision.FpFtp.Common.Domain.Data]], mscorlib","$values":[{"$type":"TBSM.Vision.FpFtp.Common.Domain.Data.FeedDerivedAttributeRuleData, TBSM.Vision.FpFtp.Common.Domain.Data","FeedCode":"All","id":"a513ede8-d520-77b1-65f8-6377a24fdd83","mappingRules":{"$type":"System.Collections.Generic.List`1[[TBSM.Vision.FpFtp.Common.Domain.Data.DerivedAttributeRuleDataCollection, TBSM.Vision.FpFtp.Common.Domain.Data]], mscorlib","$values":[{"$type":"TBSM.Vision.FpFtp.Common.Domain.Data.DerivedAttributeRuleDataCollection, TBSM.Vision.FpFtp.Common.Domain.Data","Rule Sequence":27,"classification":"Default","id":"3ad4c21c-7e69-e1ce-473f-d477767054ec","mappingRules":{"$type":"System.Collections.Generic.List`1[[TBSM.Vision.FpFtp.Common.Domain.Data.RuleData, TBSM.Vision.FpFtp.Common.Domain.Data]], mscorlib","$values":[
  </code></pre>
  
  <p>and goes on from there.</p>
  
  <p>I specified MaxCharLength as you can see.  How can I stop the truncation and get all of my JSON data</p>