我有以下代码
EXECUTE sp_execute_external_script
@language = N'R',
@script = N'
table1 <- unserialize(Table1_Data)
table2 <- unserialize(Table2_Data)
df_1 <-merge(x=table1,y=table2,
by=c("batchId","BatchTaskID"),all=TRUE)
df_2 <- df_1 %>% filter(batchId == 5 & BatchTaskStatus == 'N') %>%
arrange(desc(BatchTaskRunID))
if(nrow(df_2) > 1){
result = TRUE
return(result)
}
else {
result = FALSE
return(result)
}
OutputDataSet <- result
',
@params = N'@Table1_Data VARBINARY(MAX), @Table2_Data VARBINARY(MAX)',
@Table1_Data = @Table1_Data,
@Table2_Data = @Table2_Data
WITH RESULT SETS (( INT ));
如何仅从输出数据集返回标志值而不是整个数据帧?