SQL Server SET FMTONLY is deprecated. How do you get the structure of multiple resultsets?

Tom Schreck

I understand after SQL Server 2012 SET FMTONLY will be deprecated. I've developed a sophisticated code generation system that analyzes the results of a stored procedure and generates C# code for repository, data contracts, and business library. I'm utilizing SET FMTONLY to analyze the resultset(s) of stored procedures to understand the datacontract the stored proc is producing. This contract gets generated into an interface and it's implementation. I'm able to take a stored procedure returning multiple recordsets and return the data as a data contract to client.

I cannot find a replacement for SET FMTONLY that analyzes all of the resultsets for a Stored proc. Does anyone have any insight on how I can retrieve the columns, data types, etc for each and every resultset for a stored proc?

Thanks for your help.

Dan Guzman

SET FMTONLY ON is flawed in that it considers all SELECT statements as unconditional. The replacements, sp_describe_first_result_set and sp_describe_first_result_set_for_object, only return meta data for the first result set so that will not work in your situation. Those procs also raise an error in the case of multiple results with incompatible meta data.

I suggest you retrieve the meta data in your C# code by actually executing the procs against a newly built and deployed database, using SqlDataReader methods to retrieve meta-data. This method also handles dynamic SQL well. The only case where this approach is problematic is if the data contract varies depending on the values passed, which is a design issue anyway.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do you set collation for an entire query in SQL Server in order to do a case insensitive search?

From Dev

How do you set collation for an entire query in SQL Server in order to do a case insensitive search?

From Dev

Expecting multiple ResultSets, but only get one

From Dev

How do you declare and use a Set data structure in groovysh?

From Dev

No fields for dynamic SQL stored procedure in SSRS with SET FMTONLY

From Dev

No fields for dynamic SQL stored procedure in SSRS with SET FMTONLY

From Dev

SQL SERVER How do you insert multiple rows using Insert into select statement

From Java

In a Nested Navigator Structure of Flutter, How do you get the a Specific Navigator?

From Dev

How do you get a node that contains a child node with a given attribute value in an XML document using sql server?

From Dev

Get XML structure in SQL SERVER

From Dev

Get XML structure in SQL SERVER

From Dev

How do you search for issues resolved by a set of users (multiple users)?

From Dev

How do you search for issues resolved by a set of users (multiple users)?

From Dev

How do i do multiple insert into multiple table in sql server

From Dev

How do you configure a BizTalk WCF-SQL adapter to get data from a SQL Server 2012 "always on" replica database?

From Dev

SQL Server: How do I get the highest value not set of an int column?

From Dev

SQL Server: How do I get the highest value not set of an int column?

From Dev

How do you get get absent rows from a SQL table?

From Dev

How do I get rows which have multiple values on the other column in sql server?

From Dev

How do you set/get/use the name of a block in TPL Dataflow?

From Dev

How do you access get parameters in racket server application

From Dev

How do you access get parameters in racket server application

From Dev

How do you get multiple resultset from a single CallableStatement?

From Dev

How to get all columns when you do group by for multiple columns?

From Java

How do you clear the SQL Server transaction log?

From Dev

How do you exclude another table from a query in SQL Server?

From Dev

How do you force SQL Server to release memory?

From Dev

How do you manually start SQL Server 2014?

From Dev

How do you modify a temporal table in SQL Server 2016 or Azure?

Related Related

  1. 1

    How do you set collation for an entire query in SQL Server in order to do a case insensitive search?

  2. 2

    How do you set collation for an entire query in SQL Server in order to do a case insensitive search?

  3. 3

    Expecting multiple ResultSets, but only get one

  4. 4

    How do you declare and use a Set data structure in groovysh?

  5. 5

    No fields for dynamic SQL stored procedure in SSRS with SET FMTONLY

  6. 6

    No fields for dynamic SQL stored procedure in SSRS with SET FMTONLY

  7. 7

    SQL SERVER How do you insert multiple rows using Insert into select statement

  8. 8

    In a Nested Navigator Structure of Flutter, How do you get the a Specific Navigator?

  9. 9

    How do you get a node that contains a child node with a given attribute value in an XML document using sql server?

  10. 10

    Get XML structure in SQL SERVER

  11. 11

    Get XML structure in SQL SERVER

  12. 12

    How do you search for issues resolved by a set of users (multiple users)?

  13. 13

    How do you search for issues resolved by a set of users (multiple users)?

  14. 14

    How do i do multiple insert into multiple table in sql server

  15. 15

    How do you configure a BizTalk WCF-SQL adapter to get data from a SQL Server 2012 "always on" replica database?

  16. 16

    SQL Server: How do I get the highest value not set of an int column?

  17. 17

    SQL Server: How do I get the highest value not set of an int column?

  18. 18

    How do you get get absent rows from a SQL table?

  19. 19

    How do I get rows which have multiple values on the other column in sql server?

  20. 20

    How do you set/get/use the name of a block in TPL Dataflow?

  21. 21

    How do you access get parameters in racket server application

  22. 22

    How do you access get parameters in racket server application

  23. 23

    How do you get multiple resultset from a single CallableStatement?

  24. 24

    How to get all columns when you do group by for multiple columns?

  25. 25

    How do you clear the SQL Server transaction log?

  26. 26

    How do you exclude another table from a query in SQL Server?

  27. 27

    How do you force SQL Server to release memory?

  28. 28

    How do you manually start SQL Server 2014?

  29. 29

    How do you modify a temporal table in SQL Server 2016 or Azure?

HotTag

Archive