importing data from excel to Sql server table
in support operations common task is importing the data from excel sheet to Sql server table
business will give some master data , we need to load the data in Sql server tables. in that scenario how we can do this task very quickly
open the excel sheet that contains the data like this
Save this file with csv format
Create a table for the data insertion, if table is already there, then no need of file creation
As we don’t have table for holding this data, iam creating file
USE tempdb
GO
CREATE TABLE CSVtable
(ID INT,
Name varchar(20),
salary money
)
GO
Run the below script
BULK
INSERT CSVtable
FROM ‘E:test.csv’
WITH
(
FIELDTERMINATOR = ‘,’,
ROWTERMINATOR = ‘n’,
FIRSTROW=2
)
GO
We can see the data in the table now
Thanks for viewing this.
Regards,
Chaitanya
Visit site: http://www.sqlblogging.com
Send an Email: sqlblogging


