Sometimes you need to know what the metadata for a query looks like before runtime. This is particularly relevant with SSIS.
I use it rarely but every time I do have a need for it, I can never remember the name of the option and it takes me an hour at least to track it down again. So I'm hereby cementing it in stone so I don't forget it again!
SET FMTONLY ON
That's the one. It will return the columns and data types to the query engine. Note: it does not actually run the query or return any results. It's purely to return metadata about the query.
It's surprisingly handy from time to time.
No comments:
Post a Comment