SQL flat file import of selected columns

Is it possible to import a flat file, and only get selected columns? I am using the SQL Management Studio import wizard, and when I tell it to skip the column, it simply deletes the headers, and shifts everything down, making a total mess of everything.

If I have four columns, and only want to import columns 2 and 3. How do I go about doing that.

I am sure I can do it by editing the flat file, but this is something I am trying to automate that will be delivered nightly.

Any help would be greatly appreciated.
phil301Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ambidextrousCommented:
Hi Phil -

  When walking through the wizard try not to delete any columns.  Walk through the wizard until you get to the screen that asks which destination table to import into.

  Click on the "Edit Mappings" button.

  Within the "Destination" column of the Column Mappings dialogue you can select "<ignore>" for each column you do not want imported / created in your final destination table.

Hope that helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
efibnCommented:
If you will use SSIS you will probably solve this very quickly.
Are you familiar with SSIS (SQL Server Integration Services) ?

If not it is very simple and friendly tool to use once you know it:

1

SSIS Tutorial: Creating a Simple ETL Package
Talking about importing frmo flat file:

2

SSIS Tutorial: Working with Connection Managers
Finally and most important for you is this link:

3

SSIS: Importing data from a text file using a package
Good luck and have fun with it :)
Efi.
0
phil301Author Commented:
Thanks guys, I am not familiar with working with SSIS directly, I was saving the IMPORT as an SSIS package to execute.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

efibnCommented:
Next step for you "to automate that will be delivered nightly" as you said.
Once your Package will be ready (.dtsx file),
you would like to Schedule and Run a SSIS package ( DTS ) Job:

How to Schedule and Run a SSIS package ( DTS ) Job

0
efibnCommented:
Try this link from Microsoft Technet:

Managing SSIS Packages with SQL Server Management Studio
0
phil301Author Commented:
Great guys, thanks for the quick answers. This will help tremendously.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.