GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Tech FAQs  >  SQL Server

 Print  |  
Question:  Transferring data from text file

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


August 08, 2008 00:41:50 #1
 sakthi.jaganathan Oracle Expert  Member Since: August 2008    Total Comments: 7 

RE: Transferring data from text file
 
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 )

              
     

 

Back To Question