December 9, 2007 at 5:44 am
can we copy paste excel data into sql tables. How ?
December 9, 2007 at 8:19 am
No...
But you can write forumulas in the Excel spreadsheet that will create the necessary INSERT/SELECT or INSERT/VALUES statements.
There's also several ways to import the data from a spreadsheet into SQL Tables using OpenRowSet... if you get clever with [Sheet1$] by adding either range names or cell coordinates, you can do some pretty remarkable stuff... see the following URLs...
http://www.sql-server-helper.com/tips/read-import-excel-file-p03.aspx
http://www.sql-server-helper.com/tips/read-import-excel-file-p02.aspx
http://www.sql-server-helper.com/tips/read-import-excel-file-p01.aspx
--Jeff Moden
Change is inevitable... Change for the better is not.
December 9, 2007 at 10:51 pm
Thanks Jeff,
but its about bringing the data in a new table in sql. what if we want to append the data to an existing table.
December 9, 2007 at 10:57 pm
Think about it... 😉 See page 3 where they have the following code...
INSERT INTO [dbo].[Address_Temp] ( [FirstName], [LastName], [Address], [City], [State], [ZIP] )
SELECT [FirstName], [LastName], [Address], [City], [State], [ZIP]
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Source\Addresses.xls;IMEX=1',
'SELECT * FROM [Sheet1$]')
...I'd say the table already exists there... 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
December 28, 2007 at 2:30 am
and you can find lot of informations here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926
Failing to plan is Planning to fail
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply