:::: MENU ::::

Return only meta data through Set FMTONLY

  • Feb 07 / 2009
  • 0
dbDigger, SET Options, T-SQL Tips and Tricks

Return only meta data through Set FMTONLY

Recently i read an interesting question on SQLServerCentral.com, with main point that what function we can use to get just meta data instead of associated data from a T-SQL statement. It is interesting. After submitting my reply (which was accidentally correct), i read the provided BOL link and came to know that SET FMTONLY on or Off, we may getjust meta data instead of associated data through a T-SQL command. For example consider the impact of using this function

 
Use AdventureWorks  
 GO   
 SET FMTONLY ON  
 GO   
 SELECT * FROM production.Document  
 GO  
 SET FMTONLY off   
 GO  

SET FMTONLY ON
And instead of retreiving whole data, i just got name of columns from my script. You may use it on SQL Srever 2000, SQL Server 2005 and SQL Server 2008. You require membership of Public role to use this function.

Consult us to explore the Databases. Contact us