-1

I've got a txt file with thousands of words separated by a ";", but it could change for another special character in the future.

How can I use that txt file as input into an SQL query so I create a mass insert?, is it possible?.

Artemix
  • 8,497
  • 14
  • 48
  • 75
  • I don't know about general SQL, but if it's a MySQL you can try LOAD DATA LOCAL INFILE: http://dev.mysql.com/doc/refman/5.1/en/load-data.html – Andrew Aug 01 '14 at 19:57
  • 1
    I'd suggest you look at [Data Transformer](https://geosystemsdev.com/products/data-transformer/) (disclaimer - I'm its developer). It can convert between CSV, JSON, XML to SQL. The generated SQL contains "insert" statements for each line and a "create table" statement. The app works offline, and your data never leaves your computer. You can get it from the [Mac App Store](https://apps.apple.com/us/app/data-transformer/id1490843070) or the [Microsoft Store](https://www.microsoft.com/en-au/p/data-transformer/9p2xp6nt2pv2). – Geo Systems Feb 22 '20 at 05:05

2 Answers2

0

Since a txt file with values seperated by a ';' or other delimiter is pretty much a csv file this seems to be a duplicate of Generate Insert SQL statements from a csv file

Community
  • 1
  • 1
T_D
  • 1,688
  • 1
  • 17
  • 28
0

You can use SSIS. In SSIS you have source text file component with separator character definition. Also by SSIS you can convert your file in SQL Server, Oracle, Access, Excel, etc.

mehdi lotfi
  • 11,194
  • 18
  • 82
  • 128