Tuesday, 1 August 2017

Msg 7308, level 16, state 1, line 1

Inserting Excel sheet values into a table of SQL server.
------------------------------------------------------------

1.initially we need to install MS office of 2010 64 bit version


2.and after that  we need to install Microsoft OLEDB 12.0 64 bit software.


3.the next thing is we need to enable adhoc query option with the help of sp_configure.


4.we need to provide for the user  windows admin rights beacuase when insert is happen temp directory will get create.
and on particular datab ase user should have db_owner permission.


5.exact insert query should be like this.
SELECT * INTO [dbo.TEVA_Prescription] FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
                         'Excel 12.0;Database=D:\Projects\Teva CPMP\Prescription\my_tev_2.xlsx;HDR=YES',
                         'SELECT * FROM [report1$]')


6.the error is something like this


Msg 7308, level 16, state 1, line 1
OLEDB provider 'Microsoft.ACE.OLEDB.12.0' cannot be used for distributed queries because the
provider is configured to run in single-threaded apartment mode.

No comments:

Post a Comment

Msg 7308, level 16, state 1, line 1

Inserting Excel sheet values into a table of SQL server. ------------------------------------------------------------ 1.initially we need ...