azuredatastudio
azuredatastudio copied to clipboard
Copy Value of result view table does not copy the full value
Azure Data Studio Version: 1.12.2
Steps to Reproduce:
- have a varchar(max) column
- insert a long string >76000
- run a select query on the table
- copy the value of this column from the Results UI into a Text Editor
Results in: The string is cut somewhere around 75105
The stored data is correct and if you query the column whit len() you get the right length.
@kburtram Could this be related to the mssql.query.textSize setting you added? I can't think of any place we limit the size of copied values from the grid directly. We only limit the size we display.
@anthonydresser it looks like the default value for textSize is 2147483647 so that doesn't seem to match-up with the bug report. I'd need to investigate to understand this behavior.
@kburtram fun fact: ssms 18.4 behaves the same way, maybe there is some viewmodel reuse.
Bumping for a bit of traction and to ask if there is a workaround to get full column data from ADS.
The results to file conversions seem to only operate on whats currently displayed in the results pane, so not quite a work around. I wasn't able to find any options to go straight to file and skip the results view, which could possibly avoid this 65,000 => 75,000 character limit.
Note: For anyone working with Azure SQL on a platform other than windows, the Query Editor from within the Azure Portal doesn't have this limitation and the full data can be queried.
A year later, still an issue...
I have the same issue on ADS 1.33.0 with JSON stored in varbinary(max) field.
SELECT LEN(Content), CAST(Content AS VARCHAR(MAX)) MyContent
FROM MyTable
Right click on the value, Copy and insert to the notepad. Even though LEN returns 145110, the value is truncated to 65536 characters.
Mssql:Query:Text Size option has influence on truncation. Small Text Size truncates MyContent properly, but values larger than 65536 still result in truncation to 65536. It looks like max possible value.
The same behavior is observed in SSMS (v18.9.1) by default but there is a workaround. Large number for Query>Query options...>Results>Grid>Maximum Characters Retrieved (UI allows 2097152 max) allows to copy full value without truncation.
It would be nice to have an option similar to Maximum Characters Retrieved in SSMS or just allow Text Size to be larger than 65536.
BTW, another workaround that works both in ADS and SSMS by default (no truncation, but returns xml).
SELECT LEN(Content), CAST(Content AS VARCHAR(MAX)) MyContent
FROM MyTable
FOR XML PATH
https://github.com/microsoft/azuredatastudio/issues/392 looks related
Workaround till we have some settings in ADS
MS SQL Script to retrieve whole text using CAST to XML
SELECT CAST(clob AS XML)
FROM TABLE
WHERE
Here, column "clob" is of type Text
If column "clob" is of some other character type (Viz. varchar, nvarchar, etc) for sure we can use CAST to Text or varchar(MAX) and then cast it to XML.
This issue is still occurring on the latest version ADS, having just updated today. Would really like to see a fix on here; selecting and reading the entire contents of a VARCHAR field should be something that this application can support natively, instead of forcing us to jump through workarounds or install a third-party SQL client.
Still an issue in 2022 ADS v1.39.1
My workaround is
SELECT SUBSTRING(BindedObjectDefinition, 1, 60000) AS FullObjectDefinition, SUBSTRING(BindedObjectDefinition, 60001, 120000) AS FullObjectDefinition2 FROM [cold].[ObjectBackupLog] WHERE RowId = 6
but need to manually reduce a space between these 2 columns
I believe this may have been fixed with the added "Max chars to store" setting in related issue: https://github.com/microsoft/azuredatastudio/issues/392#issuecomment-1239773578
I believe this may have been fixed with the added "Max chars to store" setting in related issue: #392 (comment)
This worked flawlessly!
Closing this as resolved as per above comments.