zoe
zoe

Reputation: 945

SQL Server - Update a table with text file

I have a table stored in database with below sample data:

  Name     City     Age
  lily   New York   NULL
  Sam    Seattle    NULL

Now I need to update the table with a text file containing below data:

  Name     City     Age
  lily   New York   27
  Sam    Seattle    33

The text file comes without the column names. I'm not allowed to drop the current table and do a bulk insert with the new text file. Anyone knows the way around it? Thanks!!!!!!

Upvotes: 1

Views: 1621

Answers (2)

bummi
bummi

Reputation: 27385

You could create a linked Server with OLEDB-Provider for Jet-Engine with Extended Properties='text;HDR=Yes;FMT=Delimited

Upvotes: 1

fnurglewitz
fnurglewitz

Reputation: 2127

Sql Server Management Studio => Right Click on the Destination Database => Tasks => Import Data

there you will have a wizard, you can choose "flat file" as a source

i don't remember if you can script that before executing it

Upvotes: 3

Related Questions