使用sp_execute_external_script时,我无法找到WITH RESULT SETS选项的正确语法,以将结果集存储在表中。
以下是doc
中给出的语法sp_execute_external_script
@language = N'language' ,
@script = N'script',
@input_data_1 = ] 'input_data_1'
[ , @input_data_1_name = ] N'input_data_1_name' ]
[ , @output_data_1_name = 'output_data_1_name' ]
[ , @parallel = 0 | 1 ]
[ , @params = ] N'@parameter_name data_type [ OUT | OUTPUT ] [ ,...n ]'
[ , @parameter1 = ] 'value1' [ OUT | OUTPUT ] [ ,...n ]
[ WITH <execute_option> ]
[;]
<execute_option>::=
{
{ RESULT SETS UNDEFINED }
| { RESULT SETS NONE }
| { RESULT SETS ( <result_sets_definition> ) }
}
<result_sets_definition> ::=
{
(
{ column_name
data_type
[ COLLATE collation_name ]
[ NULL | NOT NULL ] }
[,...n ]
)
| AS OBJECT
[ db_name . [ schema_name ] . | schema_name . ]
{table_name | view_name | table_valued_function_name }
| AS TYPE [ schema_name.]table_type_name
}
但是我在写
时遇到错误WITH RESULT SETS
((
[IDENTIFIANT] VARCHAR(50),
[DATE] date,
[CORPUS] NVARCHAR(MAX)
) AS OBJECT [databasename].[dbo].[tablename]);
答案 0 :(得分:0)
Jeroen Mostert给出的答案:您可以使用WITH RESULT SETS((...))或WITH RESULT SETS(AS OBJECT ...),但不能同时使用两者。