Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Stored procedures and data flow task


Stored procedures and data flow task

Author
Message
stricknyn
stricknyn
SSC Veteran
SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)

Group: General Forum Members
Points: 274 Visits: 678
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



Romie
Romie
Valued Member
Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)

Group: General Forum Members
Points: 61 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).
andy.westgate
andy.westgate
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 55
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.
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8264 Visits: 19440
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
andy.westgate
andy.westgate
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 55
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.
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8264 Visits: 19440
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
andy.westgate
andy.westgate
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 55
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.
herladygeekedness
herladygeekedness
Old Hand
Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)

Group: General Forum Members
Points: 316 Visits: 813
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.
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8264 Visits: 19440
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
herladygeekedness
herladygeekedness
Old Hand
Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)

Group: General Forum Members
Points: 316 Visits: 813
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?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search