• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

import file with variable columns into DB

neegotiator

Golden Member
I don't have experience with many DB's, so apologies if this is an obvious question.

Just learned that SQL Server allows importing files with variable columns into a table. So if table exists with 5 columns, then

Col1, Col2, Col3, Col4, Col5
aaa,bbb,ccc,ddd,eee
111,222,333
fff,ggg,hhh,iii,jjj

is imported as

Col1, Col2, Col3, Col4, Col5
aaa,bbb,ccc,ddd,eee
111,222,333, NULL, NULL
fff,ggg,hhh,iii,jjj


Teradata doesn't allow this, and I could be wrong but I don't THINK Oracle allows this. Is this common among other DB's? Just seems odd to allow this, I'd imagine different number of columns in a record usually means a data issue, can't really make an assumption whether missing columns were from beg/mid/end.
 
That has more to do with the import tool you use and less with the database.

If you have a normal csv like this

Col1, Col2, Col3, Col4, Col5
aaa,bbb,ccc,ddd,eee
111,222,333,,
fff,,hhh,iii,jjj

any non-retarded import tool will import the empty values as NULL assuming that column is nullable.

And if a tool works without the commas at the end, well I would consider that a feature.
 
Back
Top