Solved

SQL Source for SSIS

Posted on 2014-04-14
4
278 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Update Query - What's wrong with this. 18 20
sql query Help 12 52
tempdb latch contention 12 47
triggered use of sp_send_dbmail failure 2 22
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

914 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

16 Experts available now in Live!

Get 1:1 Help Now