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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 OLE Automation SQLserver 7 (excel)

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-04-22 : 22:07:20
Michael writes "I'm trying to open excel in the proc below. I get an "access is denied" error and don't understand why. Also, the @obj isn't destroyed. I try to kill it in the Task Manager and I get another access denied error. What am I doing wrong?

--NT4sp4
--SQLserver 7sp3
--Excel97sr1

------------------------------------
CREATE PROCEDURE ExcelStuff AS

DECLARE @OBJ AS INT
DECLARE @RET AS INT

EXEC @RET = SP_OACREATE 'EXCEL.APPLICATION', @OBJ OUTPUT
If @RET <> 0
BEGIN
Exec sp_DisplayOAErrorInfo @OBJ, @RET
END
EXEC sp_OADestroy @OBJ
RETURN

-------------------------------------
RESULTS:
OLE Automation Error Information
HRESULT: 0x80070005
Source: ODSOLE Extended Procedure
Description: Access is denied.


p.s. If you need to know why I need to open Excel from SQLserver, I'll be happy to explain under seperate cover."

ebol
Starting Member

1 Post

Posted - 2005-01-20 : 16:26:20
I have an answer (note I didn't say "the" answer, but one that worked for me:). In my case, I had too much permission (try to throw logic aside for this). Here's the story...

Run dcomcnfg, then click the “Default Security” tab. Then click the top button to edit “Default Access Permissions”. There should be no entries here… there weren’t on [machine that worked], but were there for [machines that didn't]. Once we removed them, my problem ( “access denied” during sp_OACreate from TSQL) went away. Why would having extra permissions around deny me access, and why would deleting them give me access … ???
Go to Top of Page
   

- Advertisement -