Solved

SQL Insert Statement with SUBSTRING inside a SSIS package

Posted on 2013-05-22
6
559 Views
Last Modified: 2016-02-10
Below is the diagram that takes an excel file and imports into a SQL Database. Along with that is a filepath from a derived column. Inside that filepath contains the jobnumber. Instead of importing the whole path, I just want to extract the Job number wich SUBSTRING (Filepath, 51,12) will work.


I have an OLEDB command that contains the SQL statement to insert (Colum1, column2) values (?,?) into the SQL DB

I understand the SQL Statment using SUBString:

Insert into tableA (Column1, Filepath)

Select Column1, SUBSTRING (Filepath, 51,12) as FilePath from ......

What would be the name of the table that I am selecting from inside the OLEDB Command?

2013-05-22-10-46-53-Clipboard.gif
0
Comment
Question by:BKennedy2008
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 250 total points
ID: 39187902
>What would be the name of the table that I am selecting from inside the OLEDB Command?
Since your source is Excel, it will be either the tab name that contains the data, or an Excel named range that contains the data.
0
 

Author Comment

by:BKennedy2008
ID: 39187917
if that was it, then shoot me..
0
 

Author Comment

by:BKennedy2008
ID: 39187958
The OLE DB doesn't like the statement:

  INSERT INTO Imports (RosterName,  FilePath1)
  Select ?,SUBSTRING(?,51,12) from  ['Raw Data$']

Does this look correct? the error is unspecified, pretty sure it has to do with the statement
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 

Accepted Solution

by:
BKennedy2008 earned 0 total points
ID: 39188507
I made it easy, and just did a SUBSTRING function on the Derived column
0
 
LVL 37

Expert Comment

by:ValentinoV
ID: 39190048
Just noticed this one: you'd get much better performance if you'd use the OLE DB Destination instead of Command (which works row per row).
0
 

Author Closing Comment

by:BKennedy2008
ID: 39198770
Performing a substring closest to the source saves memory space, and is cleaner
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

623 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