+ Reply to Thread
Results 1 to 2 of 2

Thread: Is there way to insert data into the SQL Server database from csv file?

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    1

    Is there way to insert data into the SQL Server database from csv file?

    I would like to know if I can insert data from csv file to a database table in SQL Server?

    Thanks.

  2. #2
    Junior Member
    Join Date
    Dec 2011
    Posts
    1
    Yes. You can use SQL Server Management studio to insert data from csv or any other type of text file.

    Example:

    Bulk Insert [databaseName].[dbo].[myTableName]
    From 'c:\data\mydata.csv'
    With (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', DATAFILETYPE = 'widechar')


    The above SQL statment will read off mydata.csv file and insert the data to table "myTableName".
    You can use other data types. For example: DATAFILETYPE='char' or 'native' or 'widenative'.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts