0

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?

1
  • Are you trying to do this from sqlserver directly? Commented Jun 11, 2010 at 15:06

1 Answer 1

1

That technique can work if the server can see the file (and the path is relative to the server). Also, if it's on a share (or locally), then the account the server is acting under when it attempts to open the file needs to have sufficient rights to the share/directory/file.

The server also needs to have whatever provider you specify.

Are you seeing a particular error?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.