对于以下代码
$sql = "select ..... for xml path('row')" # returns a long xml file $x = Invoke-sqlCmd -Server xxxx $sql $r = $x[0].ItemArray[0]
返回的$r有一个截断的xml字符串.如何确保返回完整的长字符串?
解决方法@H_403_8@
该cmdlet具有默认的最大字符长度,对于XML或char数据类型,默认为4,000个字符[1].
请尝试以下方法:
$x = Invoke-sqlCmd -Server xxxx $sql -MaxCharLength <some large enough number>
[1] http://blogs.technet.com/b/heyscriptingguy/archive/2013/05/06/10-tips-for-the-sql-server-powershell-scripter.aspx – 搜索-MaxCharLength
请尝试以下方法:
$x = Invoke-sqlCmd -Server xxxx $sql -MaxCharLength <some large enough number>
[1] http://blogs.technet.com/b/heyscriptingguy/archive/2013/05/06/10-tips-for-the-sql-server-powershell-scripter.aspx – 搜索-MaxCharLength