SQL Server Bulk Insert

后端 未结 7 1434
说谎
说谎 2021-01-19 05:54

I want to import a one column text file into one of my sql tables. The file is just a list of swear words.

I\'ve written the following TSQL to do this



        
相关标签:
7条回答
  • 2021-01-19 06:35

    You need to use FORMATFILE for this. See BULK INSERT.

    FORMATFILE [ = 'format_file_path' ]

    Specifies the full path of a format file. A format file describes the data file that contains stored responses created using the bcp utility on the same table or view. The format file should be used in cases in which:

    * The data file contains greater or fewer columns than the table or view.
    
    * The columns are in a different order.
    
    * The column delimiters vary.
    
    * There are other changes in the data format. Format files are usually created by using the bcp utility and modified with a text editor as needed. For more information, see bcp Utility.
    

    For more detailed information, see Using Format Files.

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