Wednesday, December 24, 2014

Excel to SQL Server -Bulk Insert








 
text:file

BULK INSERT ExcelImportTraining.dbo.product
FROM 'C:\Demo\product.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n',
firstrow = 2
)

note:
'\n' - refers to the carriage return

Excel file: Products.xlsx ( excel 2007)
save as :Product.csv

Open in google Note++ Product.csv
there are rows "Cost"  within " "

Open the Excel file, choose the "Cost" whole column , right click choose as "text".

Then run the "BULK INSERT"  command in query analyzer.
 
 


No comments:

Post a Comment