Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Stored procedures and data flow task Expand / Collapse
Author
Message
Posted Thursday, January 24, 2008 4:49 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 11:22 PM
Points: 266, Visits: 590
Hello,

I have a complex stored procedure which returns some results. I want to take this stored procedure and use it in a Data Flow task to move these results to a table. The data flow source task only gives me the option for using SQL commands not stored procedures. Even if I use 'exec proceduredname' it still doesn't work. anyone know how would I go about transfering stored procedure results to a table?

Thanks,

Strick



Post #447257
Posted Thursday, January 24, 2008 5:52 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, February 2, 2010 4:03 PM
Points: 59, Visits: 50
Hi,

What error are you getting? the OLE DB datasource will work if you choose 'SQL command' as the Data access mode and in the SQL command text use

exec spName with ? for each parameter (if any).

Click parameters to map the stored procedure parameter name(s) (including @) to a variable(s).
Post #447271
Posted Tuesday, June 18, 2013 3:33 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 21, 2014 9:36 AM
Points: 9, Visits: 45
To the OP (if still around) did you solve this easily?

This is also the problem I am having.

I want to execute a stored proc and output the results to an excel file. I can set up an exec sql task fine but when I try map it to an excel destination it won't recognise any columns and when I build the execl sql task is says the exec sql construct or statement not supported.

When I try a script component it won't recognise any input columns.

It feels like this should be easy but I think I missing something simple somewhere.

Any help greatly appreciated.
Post #1464533
Posted Tuesday, June 18, 2013 7:58 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:15 AM
Points: 5,317, Visits: 12,354
andy.westgate (6/18/2013)
To the OP (if still around) did you solve this easily?

This is also the problem I am having.

I want to execute a stored proc and output the results to an excel file. I can set up an exec sql task fine but when I try map it to an excel destination it won't recognise any columns and when I build the execl sql task is says the exec sql construct or statement not supported.

When I try a script component it won't recognise any input columns.

It feels like this should be easy but I think I missing something simple somewhere.

Any help greatly appreciated.


The ExecuteSQL task is not the one you want here.

What you need is a DataFlow and inside that DataFlow you should should put an OLEDB source pointing to your stored proc.

Then create your Excel destination and join the two - you should be able to do your column mapping from there.

Note that if your stored proc selects from a temp table you may need additional guidance before SSIS 'recognises' the columns.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.

It is better to keep your mouth shut and appear stupid than to open it and remove all doubt. (Mark Twain)
Post #1464667
Posted Tuesday, June 18, 2013 8:15 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 21, 2014 9:36 AM
Points: 9, Visits: 45
Thanks Phil

Good to have that confirmed. It was the lack of mapping between the DFT and the Exceil destination that was throwing me but I have a couple of things to go on now.
Post #1464680
Posted Tuesday, June 18, 2013 8:18 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:15 AM
Points: 5,317, Visits: 12,354
andy.westgate (6/18/2013)
Thanks Phil

Good to have that confirmed. It was the lack of mapping between the DFT and the Exceil destination that was throwing me but I have a couple of things to go on now.


No problems. Maybe my message was not totally clear though - the OLEDB source and Excel Destination should both be contained in the dataflow. It is the source and destination which should be linked, not the dataflow and the destination.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.

It is better to keep your mouth shut and appear stupid than to open it and remove all doubt. (Mark Twain)
Post #1464684
Posted Tuesday, June 18, 2013 9:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 21, 2014 9:36 AM
Points: 9, Visits: 45
It was clear! I was just using the wrong terminilogy in reply.

All sorted now. The whole reason I started going down the Execute SQL Task route is because I couldn't get the OLE DB source to produce any columns with exec sp as the sql command.

I have since amended the sp to include set FMTONLY off (which I'm sure has othe consequences too particularly in Sql 2012) and this has meant it has brought back the columns which I can not map to an execl destination.
Post #1464742
Posted Tuesday, June 18, 2013 10:27 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, June 27, 2014 2:05 PM
Points: 287, Visits: 810
I also cannot get any columns out and the sp has no parameters so shouldn't be any setup I'm neglecting.

I'm baffled.
Post #1464777
Posted Tuesday, June 18, 2013 10:33 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:15 AM
Points: 5,317, Visits: 12,354
Are you selecting from a temp table in your process? Does your process have set nocount on at the top?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.

It is better to keep your mouth shut and appear stupid than to open it and remove all doubt. (Mark Twain)
Post #1464779
Posted Tuesday, June 18, 2013 12:46 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, June 27, 2014 2:05 PM
Points: 287, Visits: 810
ah, you got me, Phil - it IS selecting from a temp table. Well, shoot, makes perfect sense that SSIS cannot divine that from thin air.

Do I HAVE to materialize the table? The stored procedure has been in use for a while to assess "freshness" of our warehouse data. An email comes out with tables past their SLA so we know where our problems are.

It was recently decided that it would be convenient to dump All freshness data to a table, not just Past SLA, and continue the emails alerts for Past SLA.

I hadn't wanted to change the sp but it seems like maybe I can kill two birds with one stone by sending ALL data to a table in the sp and then having Only the past-SLA collected into an email.

I'm not seeing any hidden maintenance nightmares in this scenario. Am I missing something?



Post #1464836
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse