Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Plot Rendering SQL Server 2016 Using sp_execute_external_script

Has anyone figured out how to render a plot using sp_execute_external_script where the plot is returned in the SQL Management Studio result window or the message window or a popup window? I was able to output a plot to the file system but that is not ideal.

Below is how I got a plot to output to the file system.

EXECUTE  sp_execute_external_script
                @language = N'R'
              , @script = N' trellis.device(device="png", filename="c:/output/HistPlot.png");
              myHist=histogram(~col1, data=InputDataSet);
              print(myHist)'
              , @input_data_1 = N'SELECT  col1, col2 from ds.dbo.[sample]'
like image 523
ansek Avatar asked Jan 25 '26 10:01

ansek


1 Answers

Until Microsoft provide visualization capability, you could use SSMSBoost which is a free utility that could solve your problem.

Once installed, please highlight the cell with the binary picture to be read. Right click and select Visualize as and then choose picture.

Right click and select Visualize as and then choose picture

The image is going to be displayed into Paint: The image is going to be displayed into Paint

like image 110
Cyrille Tijsseling Avatar answered Jan 28 '26 05:01

Cyrille Tijsseling



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!