SQL Server Bulk Insert

后端 未结 7 1541
说谎
说谎 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:20

    In SQL Server 2008 I've found it easier to just create a file containing a lot of inserts like so, and paste that into Management Studio's query window, rather than fight with getting the format file and bulk insert file permissions just right:

    USE YourDB
    GO
    INSERT INTO MyTable (FirstCol, SecondCol)
    VALUES ('First',1),
    ('Second',2),
    ('Third',3),
    ('Fourth',4),
    ('Fifth',5)
    

    http://blog.sqlauthority.com/2008/07/02/sql-server-2008-insert-multiple-records-using-one-insert-statement-use-of-row-constructor/

提交回复
热议问题