I get an unresolved reference to the object [#aspnet_Permissions]

Problem

When I import a database that uses ASP.NET Providers I get an unresolved reference to the object [#aspnet_Permissions].

Solution

Modify the script to define the shape of the temp table by adding the additional SQL above the declaration of the cursor.

IF(OBJECT_ID('tempdb.#aspnet_Permissions') IS NULL)
BEGIN
CREATE TABLE #aspnet_Permissions
 (
Owner     sysname,  Object    sysname,    Grantee   sysname,    Grantor   sysname,    ProtectType char(10),    [Action]    varchar(60),    [Column]    sysname
)
END

Or just download the file below.

Explanation

The "#aspnet_Permissions" temp table must be created by ASPNET at the same time as the membership database is created. Because the table is not created in this script or referenced by this project the table appears as an external reference that DBPro cannot resolve.

By adding the code the table can be resolved by the DBPro project and will not create the table if it already exist on the database server you are deploying too.

aspnet_Setup_RestorePermissions.proc.sql (1.14 kb)

Comments are closed