How to import pipe delimited text file data to SQLServer table

前端 未结 2 1505
既然无缘
既然无缘 2021-01-13 01:01

I have database table represented as text file in the following pattern:

0|ALGERIA|0| haggle. carefully f|
1|ARGENTINA|1|al foxes promise|
2|BRAZIL|1|y along         


        
相关标签:
2条回答
  • 2021-01-13 01:16

    If you have a large amount of data you can use bcp to bulk import from file: http://msdn.microsoft.com/en-us/library/ms162802.aspx

    The bcp utility bulk copies data between an instance of Microsoft SQL Server and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into SQL Server tables... Except when used with the queryout option, the utility requires no knowledge of Transact-SQL. To import data into a table, you must either use a format file created for that table or understand the structure of the table and the types of data that are valid for its columns.

    0 讨论(0)
  • 2021-01-13 01:35

    You could use the Import Data feature by right mouse clicking the database, and then clicking Tasks then Import Data. This will give you a wizard which you can specify the delimiters etc. for your file and preview the output before you've inserted any data.

    0 讨论(0)
提交回复
热议问题