How can I fill SQL Server table from excel only using sql query?
Posted
by Phsika
on Stack Overflow
See other posts from Stack Overflow
or by Phsika
Published on 2010-06-11T14:42:21Z
Indexed on
2010/06/12
4:22 UTC
Read the original article
Hit count: 438
How can I do that with Microsoft.ACE.OLEDB.12.0?
CREATE TABLE [dbo].[Addresses_Temp] (
[FirstName] VARCHAR(20),
[LastName] VARCHAR(20),
[Address] VARCHAR(50),
[City] VARCHAR(30),
[State] VARCHAR(2),
[ZIP] VARCHAR(10)
)
GO
INSERT INTO [dbo].[Address_Temp] ( [FirstName], [LastName], [Address], [City], [State], [ZIP] )
SELECT [FirstName], [LastName], [Address], [City], [State], [ZIP]
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=C:\Source\Addresses.xlsx;IMEX=1',
'SELECT * FROM [Sayfa1$]')
How can I do that?
© Stack Overflow or respective owner