Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9150513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:37:16+00:00 2026-06-17T11:37:16+00:00

So I have a stored procedure in SQL Server. I’ve simplified its code (for

  • 0

So I have a stored procedure in SQL Server. I’ve simplified its code (for this question) to just this:

CREATE PROCEDURE dbo.DimensionLookup as
BEGIN
select DimensionID, DimensionField from DimensionTable
inner join Reference on Reference.ID = DimensionTable.ReferenceID
END

In SSIS on SQL Server 2012, I have a Lookup component with the following source command:

EXECUTE dbo.DimensionLookup WITH RESULT SETS (
(DimensionID int,  DimensionField nvarchar(700) )
)

When I run this procedure in Preview mode in BIDS, it returns the two columns correctly. When I run the package in BIDS, it runs correctly.

But when I deploy it out to the SSIS catalog (the same server the database is on), point it to the same data sources, etc. – it fails with the message:

EXECUTE statement failed because its WITH RESULT SETS clause specified 2 column(s) for result set number 1, but the statement sent
3 column(s) at run time.

Steps Tried So Far:

Adding a third column to the result set – I get a different error, VS_NEEDSNEWMETADATA – which makes sense, kind of proof there’s no third column.

SQL Profiler – I see this:

exec sp_prepare @p1 output,NULL,N'EXECUTE dbo.DimensionLookup WITH RESULT SETS ((
DimensionID int,  DimensionField nvarchar(700)))',1
SET FMTONLY ON exec sp_execute 1 SET FMTONLY OFF

So it’s trying to use FMTONLY to get the result set data … needless to say, running SET FMTONLY ON and then running the command in SSMS myself yields .. just the two columns.

SET NOTCOUNT ON – Nothing changed.

So, two other interesting things:

  1. I deployed it out to my local SQL 2012 install and it worked fine, same connections, etc. So it may be a server / database configuration. Not sure what if anything it is, I didn’t install the dev server and my own install was pretty much click through vanilla.

    1. Perhaps the most interesting thing. If I remove the join from the procedure’s statement so it just becomes

    select DimensionID, DimensionField from DimensionTable

It goes back to just sending 2 columns in the result set! So adding a join, without adding any additional output columns, ups the result set to 3 columns. Even if I add 6 more joins, just 3 columns. So one guess is its some sort of metadata column that only gets activated when there’s a join.

Anyway, as you can imagine, it’s driving me kind of mad. I have a workaround to load the data into a temp table and just return that, but why won’t this work? What extra column is being sent back? Why only when I add a join?

Gah!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:37:16+00:00Added an answer on June 17, 2026 at 11:37 am

    So all credit to billinkc: The reason is because of a patch.

    In Version 11.0.2100.60, SSIS Lookup SQL command metadata is gathered using the old SET FMTONLY method. Unfortunately, this doesn’t work in 2012, as the Books Online entry on SET FMTONLY helpfully notes:

    Do not use this feature. This feature has been replaced by sp_describe_first_result_set.

    Too bad they didn’t follow their own advice!

    This has been patched as of version 11.0.2218.0. Metadata is correctly gathered using the sp_describe_first_result_set system stored procedure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a stored procedure in SQL Server. Now its just that I
I have the following sniplet of a stored procedure in SQL Server Create PROCEDURE
I am using SQL Server 2008 R2. I have the stored procedure like this
Helo, My question is I have one Stored Procedure in SQL Server that returns
I have a stored procedure in SQL server that looks something like this: insert
I have a stored procedure in a SQL Server 2008 database. This stored procedure
I have the code below sitting in a stored procedure (SQL Server 2008). The
so I have a stored procedure (sql server 2008 r2) something like this BEGIN
I have a stored procedure in SQL Server CREATE PROCEDURE ParseXML (@InputXML xml) The
I have a stored procedure when I am executing this query in SQL Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.