Internal Server Error when trying to run aspnet_regsql SQL Script on DASP shared Sql Server

Discussion in 'ASP.NET 2.0' started by Bruce, Jul 11, 2005.

  1. Bruce

    Bruce DiscountASP.NET Staff

  2. Thanks for that, I've now found that it wasn't happy with print statements in the SQL. I removed said statements, checked the sql parsed ok, and then tried to re-run it in the Query Analyser in the Control Panel.


    I now get the Error: "Line 37: Incorrect syntax near 'BEGIN'."


    The start of the script looks like:



    /**********************************************************************/
    /* InstallCommon.SQL */
    /* */
    /* Installs the tables, triggers and stored procedures necessary for */
    /* supporting the aspnet feature of ASP.Net */
    /*
    ** Copyright Microsoft, Inc. 2003
    ** All Rights Reserved.
    */
    /**********************************************************************/
    GO
    SET QUOTED_IDENTIFIER OFF
    SET ANSI_NULLS ON -- We don't want (NULL = NULL) == TRUE
    GO
    SET ANSI_PADDING ON
    GO
    DECLARE @dbname NVARCHAR(128)
    DECLARE @dboptions NVARCHAR(1024)
    SET @dboptions = N'/**/'
    SET @dbname = N'DB_101887_MYDBNAME'


    /*************************************************************/
    /*************************************************************/
    /*************************************************************/
    -- Create the temporary permission tables and stored procedures
    -- TO preserve the permissions of an object.
    --
    -- We use this method instead of using CREATE (if the object
    -- doesn't exist) and ALTER (if the object exists) because the
    -- latter one either requires the use of dynamic SQL (which we want to
    -- avoid) or writing the body of the object (e.g. an SP or view) twice,
    -- once use CREATE and again using ALTER.

    IF (OBJECT_ID('tempdb.#aspnet_Permissions') IS NOT NULL)
    BEGIN
    DROP TABLE #aspnet_Permissions
    END
    GO
    CREATE TABLE #aspnet_Permissions
    (
    Owner sysname,
    Object sysname,
    Grantee sysname,
    Grantor sysname,
    ProtectType char(10),
    [Action] varchar(20),
    [Column] sysname
    )
    INSERT INTO #aspnet_Permissions
    EXEC sp_helprotect
    IF (EXISTS (SELECT name
    FROM sysobjects
    WHERE (name = N'aspnet_Setup_RestorePermissions')
    AND (type = 'P')))
    DROP PROCEDURE [dbo].aspnet_Setup_RestorePermissions
    GO
    CREATE PROCEDURE [dbo].aspnet_Setup_RestorePermissions
    @name sysname
    AS
    BEGIN
    DECLARE @object sysname
    DECLARE @protectType char(10)
    DECLARE @action varchar(20)
    DECLARE @grantee sysname
    DECLARE @cmd nvarchar(500)
    DECLARE c1 CURSOR FORWARD_ONLY FOR
    SELECT Object, ProtectType, [Action], Grantee FROM #aspnet_Permissions where Object = @name
    OPEN c1
    FETCH c1 INTO @object, @protectType, @action, @grantee
    WHILE (@@fetch_status = 0)
    BEGIN
    SET @cmd = @protectType + ' ' + @action + ' on ' + @object + ' TO [' + @grantee + ']'
    EXEC (@cmd)
    FETCH c1 INTO @object, @protectType, @action, @grantee
    END
    close c1
    deallocate c1
    END
    GO


    Any ideas?
     
  3. Morning all,
    I've been recieving an internal Server error (500) when trying to run my sql script (generated using aspnet_regsql Ref: http://community.discountasp.net/default.aspx?f=24&m=6679), on my database on the Discount ASP Sql server control panel.

    I ran the same script (without changes) on my MSDE instance, and all seem to run fine and dandy. Can any of you guru's give me a clue?
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    i can't tell what's wrong w/ the statement. it looks correct to me.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. I can't tell you why it doesn't work - I couldn't get it to work through the discount site either. I can tell you that it works when you use Enterprise Manager. If you don't have this - get the SQL2005 beta from here http://www.microsoft.com/technet/previewsqlserver2005/default.mspx . They say 4-6 weeks but it was delivered in 4 days (and the version was only 8 days old).
     

Share This Page