Tempdb Permissions Problems

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Gary Harding (nospam_at_please.com)
Date: 02/04/05


Date: Fri, 4 Feb 2005 20:31:42 -0000

Hello, we're using SQL Server 2000 on Windows Server 2003 and XP Pro.

I've read of problems with non-admin users using tempdb (see KB Q243023),
and now we've hit a related but more insidious problem using ADO/MDAC 2.8.
I thought I'd post the details here to see if it rang any bells.

It seems that column metadata for temporary tables is not properly returned
if the
current user is not a member of the Administrators group. That means that
if you
create a temporary table with a primary key, then select from that table
into
an ADO Recordset, the Recordset field for the primary key column will not
have
the correct information in its KEYCOLUMN property (its value is False).

This causes problems for us when we update fields from the temporary table
and call rs.UpdateBatch, at which point we get a failure with "Insufficient
key
column information for updating or refreshing". This must be because ADO
can't find a key column in the Recordset metadata to serve as a row
identity.

This "feature" took a while to find, since the error doesn't occur for admin
users.
It seems very odd that ADO can get the data from the table but not the key
column information.

The workaround, as with Q243023, is to run the following at every startup:

   exec tempdb..sp_addrolemember 'db_owner','guest'

Regards
Gary



Relevant Pages

  • Re: Problem with find method
    ... I am sorry that this is not my original question. ... SQL server when the field property is set to not allow NULL. ... Does anyone know whether this is a bug in ADO? ... >> My recordset does not contain only user name. ...
    (microsoft.public.vb.database.ado)
  • Re: ADO Shape and Subqueries
    ... > the second recordset, since you suggest making two recordsets insted of ... I have no idea if it is a limitaiton of the provider or SQL Server or ADO. ... That means the programmer asking for help here has got to be prepared to do ...
    (microsoft.public.data.ado)
  • Re: Cross Database Join, C++ program set up confusion
    ... Well what kind of data are you returning if it is not in Recordset? ... Recordset is returned (it is fractionally faster as ADO does not waste time ... If the default database is db1 on the ... It is a function of SQL Server. ...
    (microsoft.public.vc.database)
  • Re: Problem with find method
    ... Dear David ... recordset is beyound bof or eof. ... > SQL server when the field property is set to not allow NULL. ... > Does anyone know whether this is a bug in ADO? ...
    (microsoft.public.vb.database.ado)
  • Re: Problem with find method
    ... My recordset does not contain only user name. ... I would like to know if this is already a known issue with ADO and can be ... > SELECT fldNames FROM tblName WHERE fldName = 'something' ORDER BY fldName ... >> I am creating an VB application which connect to SQL Server. ...
    (microsoft.public.vb.database.ado)