﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Renato Buda  / How SSIS and Other Tools Obtain Metadata / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 22:09:52 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>Excellent topic!I just want to add one thing. If you use table variable or tmp table use all column names instead of just * in select statement.Forexample:Does not Workselect * from BLA_BLAUse select col1, col1,... from BLA_BLA</description><pubDate>Thu, 14 Jun 2012 17:27:53 GMT</pubDate><dc:creator>Mahmood.BilalB</dc:creator></item><item><title>RE: How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>Thank you, this is excellent tip.  Where were you 6 months ago when I spent days working around this limitation??!!!  :w00t:</description><pubDate>Sat, 08 Nov 2008 21:45:05 GMT</pubDate><dc:creator>mishaluba</dc:creator></item><item><title>RE: How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>Hi Andy,Thomas Keller is absolutely right and explained it very well.I chose SELECT COUNT(*) because that aggregate function will normally always return a row with a non-null value. That means that I could be sure that if the variable is null, the query did not return any rows, and FMTONLY was set.The code is improved if @SetFmtOnly is explicitly initialised (as in Thomas's example)Renato Buda</description><pubDate>Fri, 07 Nov 2008 03:21:53 GMT</pubDate><dc:creator>Renato Buda-153382</dc:creator></item><item><title>RE: How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>If FMTONLY is ON, all queries return zero rows, so a variable assignment in any select has no effect, and the variable keeps its previous value, which is NULL if it was never initialized. Here is another example which works in SQL2000, but at any rate you can query any table you have permission on.DECLARE @FmtOnlyTest intset @FmtOnlyTest = 0SELECT count(*) AS C FROM dbo.sysobjectsSELECT @FmtOnlyTest = count(*) FROM dbo.sysobjectsIF ( @FmtOnlyTest = 0 ) BEGIN	SET FMTONLY OFF	PRINT 'NOW OFF'END</description><pubDate>Wed, 05 Nov 2008 16:27:17 GMT</pubDate><dc:creator>Thomas Keller</dc:creator></item><item><title>RE: How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>Renato, this is a very useful and interesting article. Can you tell us how this code from your example works? It looks like  you are evaluating the status of the FMTONLY option by doing a count from sys.filegroups. I don't understand why this would return the session status of FMTONLY.CREATE PROCEDURE dbo.ExportGraphicIndexASBEGIN  DECLARE @FmtOnlyTest int; -- If this is null then FMTONLY was ON[b]SELECT @FmtOnlyTest = count(*) FROM sys.filegroups;[/b]  IF @FmtOnlyTest IS NULL -- FMTONLY was ON    SET FMTONLY OFF;</description><pubDate>Wed, 05 Nov 2008 06:32:18 GMT</pubDate><dc:creator>Andy Hilliard</dc:creator></item><item><title>RE: How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>Good article...</description><pubDate>Mon, 03 Nov 2008 18:43:47 GMT</pubDate><dc:creator>Anipaul</dc:creator></item><item><title>RE: How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>This is also useful to know when using the wizard in Visual Studio 2005 for creating Typed data Sets.The ugly work around is to create a table and select at the top of the stored procedure just to satisfy the tool, then comment it out and un-comment the realy code after that.This looks like it would be a better way. And its something I always meant to trace using profiler and never had time. Thanks.</description><pubDate>Mon, 03 Nov 2008 09:18:37 GMT</pubDate><dc:creator>cstrause</dc:creator></item><item><title>RE: How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>Good to know, and the reverse will also be useful! When you have to use a front end tool such as Excel or Access, which does not use FMTONLY, temporarily adding it to the procedure will allow building a query without waiting for full execution.</description><pubDate>Mon, 03 Nov 2008 08:22:09 GMT</pubDate><dc:creator>Thomas Keller</dc:creator></item><item><title>RE: How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>Thanks for the heads-up on the potential metadata problem.  I haven't stumbled on this problem yet, but it would have only been a matter of time.  Clever work-around!</description><pubDate>Mon, 03 Nov 2008 07:54:53 GMT</pubDate><dc:creator>Carla Wilson-484785</dc:creator></item><item><title>How SSIS and Other Tools Obtain Metadata</title><link>http://www.sqlservercentral.com/Forums/Topic595515-1411-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/FMTONLY/64130/"&gt;How SSIS and Other Tools Obtain Metadata&lt;/A&gt;[/B]</description><pubDate>Sat, 01 Nov 2008 21:58:36 GMT</pubDate><dc:creator>Renato Buda-153382</dc:creator></item></channel></rss>