azuredatastudio icon indicating copy to clipboard operation
azuredatastudio copied to clipboard

Copy Value of result view table does not copy the full value

Open iamsilvio opened this issue 6 years ago • 8 comments

Azure Data Studio Version: 1.12.2

Steps to Reproduce:

  1. have a varchar(max) column
  2. insert a long string >76000
  3. run a select query on the table
  4. 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.

iamsilvio avatar Nov 08 '19 15:11 iamsilvio

@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 avatar Nov 12 '19 22:11 anthonydresser

@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 avatar Nov 13 '19 05:11 kburtram

@kburtram fun fact: ssms 18.4 behaves the same way, maybe there is some viewmodel reuse.

iamsilvio avatar Nov 13 '19 09:11 iamsilvio

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.

colt-1 avatar Jul 18 '20 19:07 colt-1

A year later, still an issue...

joebone avatar Jul 13 '21 06:07 joebone

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

dmytro-pryvedeniuk avatar Nov 01 '21 20:11 dmytro-pryvedeniuk

https://github.com/microsoft/azuredatastudio/issues/392 looks related

dmytro-pryvedeniuk avatar Nov 02 '21 07:11 dmytro-pryvedeniuk

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.

satishfied avatar Aug 05 '22 22:08 satishfied

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.

tomwarner13 avatar Aug 25 '22 14:08 tomwarner13

Still an issue in 2022 ADS v1.39.1

gwalkey avatar Nov 08 '22 13:11 gwalkey

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

TommyLeng avatar Jan 09 '23 06:01 TommyLeng

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

Static-4eb7cf82 avatar Oct 26 '23 17:10 Static-4eb7cf82

I believe this may have been fixed with the added "Max chars to store" setting in related issue: #392 (comment)

This worked flawlessly!

Manuel-Innovapps avatar Nov 10 '23 07:11 Manuel-Innovapps

Closing this as resolved as per above comments.

cheenamalhotra avatar Nov 10 '23 16:11 cheenamalhotra