F# SQL 类型提供程序 - 为什么不提供所有存储过程?

F# SQL type provider - why aren't all stored procedures provided?

我正在尝试通过 Microsoft.FSharp.Data.TypeProviders.SqlDataConnection 类型访问现有数据库。有一些存储过程没有提供(但大多数都有)。

我正在尝试确定无法提供的程序与其他程序的区别 -- 我认为自定义类型是类型提供可能失败的原因之一,但它们似乎不存在于此处。

还有哪些其他原因可能导致我们的存储过程无法提供?

编辑:

我已将以下块确定为导致不可提供性的块:

      EXEC @intReturn = te_audit_log @action = 'I',
                                     @user_id = @intUserId,
                                     @table_id = 1,
                                     @audit_action = 'A',
                                     @data_id = @intStatus,
                                     @session_guid = @session_guid,
                                     @effective_date = @actual_timedate,
                                     @employee_id = @employee_id

...我认为这是因为正在 "exec"ed 的存储过程也有 return 值来自临时 table.

的路径

我假设类型提供程序无法获取存储过程(或其他数据库对象),因为类型提供程序无法获取有关结果集的元数据。检查 sp_describe_first_result_set SET FMTONLY

原因在备注部分的文档中指定:

sp_describe_first_result_set returns an error in any of the following cases.

If the input @tsql is not a valid Transact-SQL batch. Validity is determined by parsing and analyzing the Transact-SQL batch. Any errors caused by the batch during query optimization or during execution are not considered when determining whether the Transact-SQL batch is valid.

If @params is not NULL and contains a string that is not a syntactically valid declaration string for parameters, or if it contains a string that declares any parameter more than one time.

If the input Transact-SQL batch declares a local variable of the same name as a parameter declared in @params.

If the statement uses a temporary table.

The query includes the creation of a permanent table that is then queried.

When multiple possible first statements are found in a batch, their results can differ in number of columns, column name, nullability, and data type. How these differences are handled is described in more detail here:

If the number of columns differs, an error is thrown and no result is returned.

If the column name differs, the column name returned is set to NULL.

It the nullability differs, the nullability returned will allow NULLs.

If the data type differs, an error will be thrown and no result is returned except for the following cases:

  • varchar(a) to varchar(a') where a' > a.

  • varchar(a) to varchar(max)

  • nvarchar(a) to nvarchar(a') where a' > a.

  • nvarchar(a) to nvarchar(max)

  • varbinary(a) to varbinary(a') where a' > a.

  • varbinary(a) to varbinary(max)

根本不存在包含上述情况的数据库对象和查询。

正在检查 TSQL 存储过程return是否正确的元数据

SELECT * FROM sys.dm_exec_describe_first_result_set ('[schema].[name]',<params> , 0);