How to omit columns in a Schema.ini file? - vba

I'm building an ini files to import a complex text file to a table in Access. How do you omit a column? My text file is fixed width but still had a separator column in between each column of data that I don't need.

I was able to take #Olivier Jacot-Descombes and Kostas K. advice and create a temp table to import the data into, then run a delete query to remove the information that wasn't needed.

Related

Import csv to impala

So for my previous homework, we were asked to import a csv file with no columns names to impala, where we explicitly give the name and type of each column while creating the table. However, now we have a csv file but with column names given, in this case, do we still need to write down the name and type of it even it is provided in the data?
Yes, you still have to create an external table and define the column names and types. But you have to pass the following option right at the end of the create table statement
tblproperties ("skip.header.line.count"="1");
-- Once the table property is set, queries skip the specified number of lines
-- at the beginning of each text data file. Therefore, all the files in the table
-- should follow the same convention for header lines.

Copy content from a csv to PostgreSQL table

I am trying to copy content from a csv-file to an existing but empty table in PostgreSQL.
This is how far I've come:
COPY countries FROM 'C:\Program Files\PostgreSQL\9.5\data\countries-20140629.csv'
DELIMITERS ',' CSV HEADER
The Problem that I'm experiencing is that the csv-file containts three columns (code, english_name and French_name), whereas my table only persists of two columns (code, english_name).
Adding a third column to my table is not an Option.
Is there any way to tell PostgreSQL to only import the first two columns of the csv-file?
The easiest way is to modify your CSV and delete the last column.
You could try it like the documentation says:
In your case it would be like:
COPY countries (code, english_name) FROM 'C:\Program Files\PostgreSQL\9.5\data\countries-20140629.csv' DELIMITERS ',' CSV HEADER
Take a look in the documentation for further help:
PostgreSQL.org
As far as I can see, there is no possibility to tell postgres to only import a subset of the columns. What you can do, is to import the csv file into a temporary table and then transfer the data you want from the temporary table to your final table.

How to create format files using bcp from flat files

I want to use a format file to help import a comma delimited file using bulk insert. I want to know how you generate format files from a flat file source. The microsoft guidance on this subjects makes it seem as though you can only generate a format file from a SQL table. But I want it to look at text file and tell me what the delimiters are in that file.
Surely this is possible.
Thanks
The format file can, and usually does include more than just delimiters. It also frequently includes column data types, which is why it can only be automatically generated from the Table or view the data is being retrieved from.
If you need to find the delimiters in a flat file, I'm sure there are a number of ways to create a script that could accomplish that, as well as creating a format file.

Using Bulk Insert to import a csv file without specifying column names?

When creating a table before the bulk insert, is there a way to NOT specify the column names and use whatever column names are on the csv file? I have some columns in my csv file that are quarters, like 2012Q2, 2012Q3, etc. In the future, these are going to change depending on the time and that's why I don't want to specify the column names. If this is possible, any help will be appreciated.
Thanks!
One way to this is:
Drop the table on BigQuery
Get column names from your CSV
Create table using the column names from your CSV.
PHP example can be found here: https://github.com/GoogleCloudPlatform/php-docs-samples/blob/master/bigquery/api/src/functions/create_table.php
(the fields = your column names)
Import the CSV
Done!

Only import specific data columns - Comma Delimited List

I used the following command to import data from a text file, however, I need to find out a way of selecting specific columns within the text file. The following links have been suggested to me however I'm struggling to understand whether I need to replace my current SQL with the examples on MSDN:
BULK INSERT T2 FROM 'c:\Temp\Data.txt' WITH (FIELDTERMINATOR = ',')
http://msdn.microsoft.com/en-us/library/ms179250.aspx
http://msdn.microsoft.com/en-us/library/ms187908.aspx
I have the following fields held within a text file which is separated by comma. The data is also separated by comma enabling me to use the above code to import it all.
Date,Time,Order,Item,Delivery Slot,Delivery Time
Is there a way to only import Date, Time, Item and Delivery Time into an SQL database table?
Use a Format File for your BULK INSERT. You can specify which fields are imported through this file definition.
EDIT: example from MSDN.
BULK INSERT bulktest..t_float
FROM 'C:\t_float-c.dat' WITH (FORMATFILE='C:\t_floatformat-c-xml.xml');
GO