Issue Type: Bug
When copying results to the query window, the pasted data is not in the same order as listed in the results. Steps to reproduce:
declare @table table (num int)
declare @i int = 0
while @i<5
begin
insert into @table values (1), (2), (3)
set @i=@i+1
end
select num from @table order by num
Next, Copy the results from the grid and paste them into the query window or any text editor. The pasted values are out of order. When I do this, this is the pasted results:
1
1
3
3
3
3
3
1
1
1
2
2
2
2
2
I expect to see the pasted results to mimic the query results as shown below:
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
Similar copy/paste items: #7189, #2955, #1388, #26
Azure Data Studio version: azuredatastudio 1.13.0 (cacd481bff25c890e4130aee392569bae43b7e60, 2019-11-02T00:40:05.147Z)
OS version: Windows_NT x64 10.0.17763
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 x 3408)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled|
|Load (avg)|undefined|
|Memory (System)|31.93GB (21.03GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|
Extensions (2)
Extension|Author (truncated)|Version
---|---|---
powershell|ms-|2019.9.0
profiler|Mic|0.9.0
@jjwillis It seems to be working fine for me. Could you go through the exact steps you're taking to copy/paste this? Are you selecting the entire column or selecting the cells manually?
@aaomidi Could you look into this?
This worked fine for me this morning after I read this. Then I noticed a pending update, so I installed and now it is doing exactly as described above. And I need my results to be in an order I expect.
Last week there were tabs at the end of each line. This week, bad ordering.
@GUARD-TONYT - Could you also include the exact steps you're taking for the copy/paste? Especially with regards to how you're selecting the cells?
Open Azure Data Studio. Now running:Version: 1.13.0 (user setup)
Commit: cacd481bff25c890e4130aee392569bae43b7e60
Date: 2019-11-02T00:40:05.147Z
VS Code: 1.38.0
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17134
Opened new Qry Window on a database.
Copy/Pasted T-SQL from above into qry window. Clicked Run.
Grid appears as expected.
Clicked on Grid. Then right-clicked, chose Select All, right-clicked again, Copy with Headers.
Opened Notepad.
Pasted Results.
The results appeared in incorrect order. The results grid shows 5 of each number. The pasted data is not in the correct order.
I then altered my query to show Alphabetical Data rather than numbers. It too pasted in an order different than how the grid is displayed. I can't seem find anything in common with how the order is displayed, but it consistently shows the pasted results out of order.
Try it with these results:
declare @table table (num int)
declare @i int = 1
while @i<=25
begin
insert into @table values (@i)
set @i=@i+1
end
select num from @table order by num
I installed the latest update to ADS. Run the above statement and the results will display numbers from 1-25, one number on each row. Here are several ways I can reproduce the results:
I will note that there seems to be a pattern where row 1 and 2 are in order and row 3 is out of order.
I tried this again by selecting rows 1-10, it pasted correctly, then I tried this with rows 1-11 and it pasted wrong. Then I selected rows 11-25 and it worked correctly. Then I selected rows 10-25 and the 10th row appeared at the end and the rest were in correct order.
Then I increased my results to 100, selected row 11 and highlighted all until row 100 using shift + arrow, copied, and everything pasted correctly. The issue seems to be around row 10.
I just tried it with this SQL to get numbers out of the equation:
declare @table table (phrase varchar(50))
insert into @table values ('A is for Apple'), ('B is for Bumble Bee'), ('C is for Charlie'), ('D is for Delta'), ('E is for Elephant'), ('F is for Fox Trot')
insert into @table values ('A is for Apple'), ('B is for Bumble Bee'), ('C is for Charlie'), ('D is for Delta'), ('E is for Elephant'), ('F is for Fox Trot')
select phrase from @table order by phrase
The results are in the order you would expect. Once copied and pasted, they appear in an incorrect order. It always appears the a 1st 2 are in the correct place, then afterward something is wrong.
I'm taking a look at this now.
This issue has been fixed in https://github.com/microsoft/azuredatastudio/pull/8072 and is currently in insiders. If you can, can you verify that ADS Insiders behaves properly?
This fix will be included in the next release.
@aaomidi I downloaded the ADS Insiders and the problem is corrected. I tried all of the above samples and they now work as expected. Thank you.
@Charles-Gagnon @aaomidi Verified that this bug has been corrected with the insiders build version.
Version: 1.14.0-insider (user setup)
Commit: a8eed6114b9b9b36fe2cd1902b690090bc547ca4
Date: 2019-11-04T08:59:32.766Z
VS Code: 1.38.0
Electron: 6.0.12
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.17763