1
votes

I am working on a script that would help be extract some data from columns into text files. It concatenates several columns into single one.

Problem I am having is that when I use powershell Invoke-SqlCmd the results are shortened with ending being cut off like this

Some example text thats fine
This text is too long so it will be cu...
This is also fine

I tried to add -MaxCharLength parameter, but it does not help.

Just to confirm, results in SSMS are showing up fine with full length of generated columns.

I check the length of problematic column and it has 213 characters. Is there any workaround for that?

are you certain that the actual value is truncated? most of the time, an apparent value truncation is actually just the display that is truncated. - Lee_Dailey
This is most certainly a display thing. Each column returned from Invoke-SqlCmd is limited in characters when displayed in a table. If, however, you store that data into a variable, then the full values are stored in said variable. - Larnu