I'm running the following query from a powershell command which unfortunately truncates or adds dots to the end of the result string. I had adjusted the screen buffer size for powershell i.e. right click on powershell Properties>Layout>Screen Buffer Size> width and height set to 9999 (max). It seems like the output is limited to the powershell screen buffersize and I can't seem to get around this one. Any help is appreciated please.
Invoke-Sqlcmd -ServerInstance myrds.com -Database mydb -Username dbuser -Password passord -maxcharlength 80000 -Query "SELECT CAST(BINARYCOL AS VARCHAR(MAX)) FROM OLTP_TABLE WHERE ID=123123 AND COMPANYID=123" | Out-File -FilePath "C:\Users\USER\Documents\ps_scripts\res3.txt"
bcpinstead? That's designed to have the output from a command saved to a file.select datalength(binarycol) from oltp_table where id=123123 and companyid=123returns a number greater than9999?Format-List. However, if you are outputting a collection of items within a property, the default shell is limited to 4 items before truncating with.... To fix this, you need to change$formatenumerationlimit = -1(for unlimited) or some other appropriate number.