Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Import data from excel

Author  Topic 

razeena
Yak Posting Veteran

54 Posts

Posted - 2011-07-26 : 04:42:18
I have an excel file 'Product.xls' containing two columns
PName and Price.
How could I import data from excel(.xls) file to sql server 2008 R2
table 'tblProducts'?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-07-26 : 04:56:17
In object explorer
right click the destination database -> tasks -> import



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

razeena
Yak Posting Veteran

54 Posts

Posted - 2011-07-26 : 05:55:55
Thank you.
Another method found is
BULK
INSERT <table>
FROM 'D:Table.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO

quote:
Originally posted by webfred

In object explorer
right click the destination database -> tasks -> import



No, you're never too old to Yak'n'Roll if you're too young to die.

Go to Top of Page
   

- Advertisement -