We help IT Professionals succeed at work.
Get Started

creating a SSIS package that runs a comma delimited file. Issue with field spliting due to space.

787 Views
Last Modified: 2012-05-12
I am tryng to create an automated process for a user. I have created a sql script and I have used the SSIS tool to create a package which runs and appends the data in the selected .csv file.
My isssue is that when the address or name has 3 spaces in a row in seperates the information and it is not in line anymore. Please see my code below.. there might just be something easy that I can do to keep these fields together somehow.

Your help is greatly appeciated
select DISTINCT 
       "LocationID" = 
				 CASE WHEN category = '6601' Then '10049636' 
				      WHEN category = '6650' Then '10049636' 
		     	      WHEN category = '8412' Then '10013190' 
				 END,
		'RSLR' AS 'Reporting Partner Type',
		CustomerName AS 'End Customer Ship To Name',
		InvoiceShipToAddress AS 'End Customer Ship To Address 1',
		' ' AS 'End Customer Ship To Address 2',
		CustomerCity  As 'End Customer Ship To City',
		CustomerState  As 'End Customer Ship To State',
		CustomerZip  As 'End Customer Ship to Zip',
		' ' AS 'End Customer Ship To Phone',
	    ' ' AS 'Bill To Name',
		' ' AS 'Bill To Address 1',
		' ' AS 'Bill To Address 2',
		' ' AS 'Bill To City',
		' ' AS 'Bill To State/Province',
		' ' AS 'Bill To Postal Cd',
		'39' AS 'Quantity Qualifier',
		'Quantity' = CAST(qty AS varchar(30)),
		Item AS 'HP Part Number',
		'3' AS 'Data Type Qualifier',
	   'Invoice Date' = Convert(char(10), Date, 101),
	    ' ' AS 'Reseller Assigned Part Number',
	    ' ' AS 'Unit Price', 
	    'S' AS 'Transaction Type',
	    'Invoice Number' = CAST(InvoiceID AS varchar(15)),
	    ' ' AS 'UPC Code',
	    ' ' AS 'Big Deal_Contract Number',
	    ' ' AS 'Serial Number' 
from vw_jbarman_HP_WeeklySales 
where category IN ('6650', '6601', '8412')

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 38 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE