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:

Post a Comment

Amazon Contextual Product Ads

Popular Posts