'more VARBINARY columns in result set fo SQL Server R sript
In my R script for MS SQL Server I try to return one column VARBINARY() and one VARCHAR(). However, server allow only one column when VARBINARY is returned:
There can be only one column in the result set when using the 'varbinary' data type.
Example code:
EXEC sp_execute_external_script @language =N'R',
@script=N'R,
ff = tempfile();
png(filename=ff, width=800, height=800);
plot(...);
dev.off();
f1 = file(ff,"rb");
d1 = readBin(f1, what=raw(), n=1e6);
dd = data.frame(d1, c("plot1");
colnames(dd) = c("plot", "title");
OutputDataSet = dd;',
@input_data_1 =N'SELECT * FROM table_name'
WITH RESULT SETS ((plot varbinary(max)), (dsc varchar(20));
How to return additional columns with VARBINARY column?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|