This is the eight post of SET Statement series
when SET FMTONLY set to ON, query will return only metadata to the client. This setting can be used to test the format of the response without actually running the query.
USE AdventureWorks2012;
GO
SET FMTONLY ON;
GO
SELECT *
FROM Production.Product;
GO
SET FMTONLY OFF;
GO
Output of this is,
So there will be no rows returned.
However, this SET option is set to depreciate with SQL Server 2012.
Previous posts of this series,
of course, you can always revert to the old tried and true...
ReplyDeleteselect * from dbo.whatever where 0=1
...and get the same result. :)
By Michelle Poolet From SQL DBA Support Linkedin Group