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)
 approles and temp tables

Author  Topic 

pkolf
Starting Member

4 Posts

Posted - 2004-06-04 : 13:28:36
I seem to be having trouble with temp tables when accessing by means of an approle.

If I connect to the database, use sp_setapprole, and run two identical stored procedures except that one contains the statement "select 'abc' as abc into #t", the one containing that statement fails while the other functions properly.

Any ideas?

Thanks, -Paul

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-04 : 13:31:20
What is the error that it fails with?

Tara
Go to Top of Page

pkolf
Starting Member

4 Posts

Posted - 2004-06-04 : 14:12:39
The error I get is

***
Load\ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
***

Actually I seem to get away with select into #t sometimes but I cannot select from #t

-Paul
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-04 : 14:21:48
Ok, since that is not a SQL Server error, what happens when you execute the queries inside Query Analyzer?

Tara
Go to Top of Page

pkolf
Starting Member

4 Posts

Posted - 2004-06-04 : 14:25:10
It works fine. Even when you apply the approle.

-P
Go to Top of Page

cra
Starting Member

2 Posts

Posted - 2004-06-24 : 08:32:21
I have the same error.
If a make a temp table # in my store procedure then i have an error.
Go to Top of Page

pkolf
Starting Member

4 Posts

Posted - 2004-06-24 : 09:17:25
I finally resolved the problem by adding "SET NOCOUNT ON" to the SP

Hope that works for you,
-Paul
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-24 : 12:11:06
SET NOCOUNT ON should be the first statement after the AS in a stored procedure.

Tara
Go to Top of Page
   

- Advertisement -