Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

File import to table in Unix Expand / Collapse
Author
Message
Posted Sunday, January 12, 2014 11:00 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 12, 2014 5:14 AM
Points: 48, Visits: 161
Phil Parkin (1/12/2014)
sql crazy kid (1/12/2014)
Phil Parkin (1/12/2014)
Columns are not missing here . I have 5 column here ,looks like this.
[Just a sample data ,but this is the format we load]
col1 col2 col3 col4 col5
USD 1542.52 14536 xxxx
1542.52 14536
EUR 1542.52 14536 xxxx


What would this sample data look like if there were no problems with delimiters?


I am getting output as like below when i do bcp command on unix.
C1 C2 C3 C4 C5
USD 1542.52 14536 xxxx
1542.52 14536 EUR|1542.52|14536|xxxx


I understand, but that is not the question I am asking.



If there is no problem,output would be
C1 C2 C3 C4 C5
NULL USD 1542.52 14536 xxxx
NULL NULL 1542.52 14536 NULL
EUR NULL 1542.52 14536 xxxx
Post #1530126
Posted Sunday, January 12, 2014 11:16 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 7:59 AM
Points: 4,976, Visits: 11,666
If there is no problem,output would be
C1 C2 C3 C4 C5
NULL USD 1542.52 14536 xxxx
NULL NULL 1542.52 14536 NULL
EUR NULL 1542.52 14536 xxxx


Great, that helps.

Now my question is: why in the above is there a NULL after EUR in row 3?

That, surely, is a missing column, if the source is

EUR|1542.52|14536|xxxx

?




Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1530132
Posted Sunday, January 12, 2014 11:28 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 12, 2014 5:14 AM
Points: 48, Visits: 161
Phil Parkin (1/12/2014)
If there is no problem,output would be
C1 C2 C3 C4 C5
NULL USD 1542.52 14536 xxxx
NULL NULL 1542.52 14536 NULL
EUR NULL 1542.52 14536 xxxx


Great, that helps.

Now my question is: why in the above is there a NULL after EUR in row 3?

That, surely, is a missing column, if the source is

EUR|1542.52|14536|xxxx

?



Thanks for getting into deeper
Few of the rows , first column coming as empty . But do you think in SSIS or Excel this will be a issue as there is a column delimiter to treat the 1st column as empty.
Post #1530134
Posted Sunday, January 12, 2014 11:47 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 7:59 AM
Points: 4,976, Visits: 11,666
Thanks for getting into deeper
Few of the rows , first column coming as empty . But do you think in SSIS or Excel this will be a issue as there is a column delimiter to treat the 1st column as empty.


You've avoided my question again!

If your question can be restated as:

Sometimes there will be four columns in a row, sometimes five columns.

Will SSIS know which of the columns is missing?

The answer is no.

But if you know that there is a rule such as: if there are four columns in a row, add a fifth as Col1 and set its value to NULL, that can be done.

I'm going to sign off now, by saying that if you can come up with the necessary logical steps to process your file (and I don't think that you're there yet), it will be possible to implement those steps in SSIS. It might require some scripting.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1530137
Posted Monday, January 13, 2014 10:16 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 12, 2014 5:14 AM
Points: 48, Visits: 161
Phil Parkin (1/12/2014)
Thanks for getting into deeper
Few of the rows , first column coming as empty . But do you think in SSIS or Excel this will be a issue as there is a column delimiter to treat the 1st column as empty.


You've avoided my question again!

If your question can be restated as:

Sometimes there will be four columns in a row, sometimes five columns.

Will SSIS know which of the columns is missing?

The answer is no.

But if you know that there is a rule such as: if there are four columns in a row, add a fifth as Col1 and set its value to NULL, that can be done.

I'm going to sign off now, by saying that if you can come up with the necessary logical steps to process your file (and I don't think that you're there yet), it will be possible to implement those steps in SSIS. It might require some scripting.


Thank you for your time and effort put in. As you said this is a data issue ,we are done is our end corrected file and bcp into the table. Another think this is hard to connect SSIS from Unix .
Post #1530371
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse