sp_describe_first_result_set , To get metadata of the query


Sometime application developer are not completely aware of the result set provided by the query.
They have to run the query to see result data type or refer table structure to decide data type and other related info,now there is system store proc which will give this basic and very useful info of the query


lets see one example


sp_describe_first_result_set @tsql = N'SELECT * FROM Person.Address'



lets see the result






lets use a view which is join of multiple tables



sp_describe_first_result_set @tsql = N'select * from HumanResources.vEmployee'


3 comments:

Dharti said...

Its good for application developers.

Dharti said...

What about version before denali?

Unknown said...

you have to use sp_help. That will provide you basic information.
But even that also not provide such detailed information.

Post a Comment

Popular Posts