Transferring data from text file

How to transfer data from a text file to SQL table, Which is the best method to do that?

Questions by Veeramma

Showing Answers 1 - 1 of 1 Answers

By using OPENROWSET command

Example:
                   INSERT INTO dbo.ImportTest
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:ImportData.xls', 'SELECT * FROM [Sheet1$]')

We can do it in anotherway also by using BULK INSERT

Example:
                

                      BULK INSERT dbo.ImportTest
                      FROM 'C:ImportData.txt'
                      WITH ( FIELDTERMINATOR =',', FIRSTROW = 2 )

              

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions