Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


File import to table in Unix


File import to table in Unix

Author
Message
sql crazy kid
sql crazy kid
SSC Journeyman
SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)

Group: General Forum Members
Points: 78 Visits: 243
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
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8317 Visits: 19465
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
sql crazy kid
sql crazy kid
SSC Journeyman
SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)

Group: General Forum Members
Points: 78 Visits: 243
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.
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8317 Visits: 19465
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
sql crazy kid
sql crazy kid
SSC Journeyman
SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)

Group: General Forum Members
Points: 78 Visits: 243
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 .
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search