If I needed to retrieve only metadata of a result, what is the difference between using FMTONLY vs. a “select top 0 …” ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I was interested in this too, after a bit of googling I found that FMTONLY is the standard vs options like Select top 0 / SELECT whatever WHERE 1=0 because as Icarus said you cant use SELECT TOP 0 for finding out what a stored proc returns.
Also when using FMTONLY Sql server wont generate / compile an execution plan since the statement isnt actually being executed.
FMTONLY is the method SSRS / Visual Studio uses when reading stored procs to get the column names.