Solved

SQL Source for SSIS

Posted on 2014-04-14
4
277 Views
Last Modified: 2016-02-10
Hello:

I'm planning on creating a TSQL view containing data that will be extracted by SSIS.  The first section of the view is to be a header section of about five fields.  The next four sections will be the body of the data containing anywhere from eight to thirty fields.  The final section will be a footer of about three fields.

First, is it possible to create a TSQL view containing sections with different numbers of fields like this?  If not, what other solutions are there?  I have created views many times in the past, with UNION ALL statements, but each statement separated sections that contained an equal number of fields.

Secondly, is it possible to tell SSIS to not pull column headings when extracting data from SQL?

Ultimately, I want to create a text file from SSIS that will be uploaded by a bank.  Banks have very strict requirements as to the format of the data in such files.

Thanks!

TBSupport
0
Comment
Question by:TBSupport
  • 3
4 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39999071
>I'm planning on creating a TSQL view containing data that will be extracted by SSIS.
Ok.

>The first section of the view is to be a header section of about five fields.  The next four sections
Unless you have Super Ninja T-SQL skills, it's asking a lot of a view to contain multiple sections with varying fields in each section.  Better to create a view for each section, with a 'sort_order' column that goes something like 1 for the header, 2 for a group header, 3 for the detail, 4 for the footer, you get the idea.  

Then in your output write all columns as one, with an 'ORDER BY sort_order' to write the header, detail, etc. in the correct order.

>is it possible to tell SSIS to not pull column headings when extracting data from SQL?
Yes, eyeballeth the connection properties.
0
 
LVL 1

Author Comment

by:TBSupport
ID: 39999092
Thanks for the quick response, Jim!  Excellent!

Can you please elaborate on the following:

...in your output write all columns as one, with an 'ORDER BY sort_order' to write the header, detail, etc. in the correct order?

I don't understand how to get the TSQL syntax to accommodate this.  I thought that "ORDER BY" was forbidden in views.

Thanks, again!

TBSupport
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39999118
Trying to remember a previous project where I pulled this off, so bear with me.
The ORDER BY isn't in a view, it's in a SELECT that writes to the destination.

Source
Three views, essentially a header, detail, and footer view.
After the Source I had a merge join, that went something like this..

SELECT 1 as sort_order, column_1 + column_2 + column_n as the_row
FROM v_header
UNION ALL
SELECT 2, column_A + column_B + column_C + column_KIIJR
FROM v_detail
UNION ALL
SELECT 3, column_banana + column_grape
FROM v_footer

Destination
SELECT the_row
FROM {my table}
ORDER BY sort_order
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39999424
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I'd like to talk about something that is near and dear to my heart: build systems. Without them, building software is all about compiling locally, with software versions everywhere. It can be a mess. Today we are going to discuss building a small di…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now