Change sequence schema

  • Hi all,

    I have some sequences and I want to change their schmas. How can I perform this action without drop and recreating (because of not changing current value) ?

  • Problem solved :w00t:

    SELECT name

    INTO #test

    FROM sys.sequences

    DECLARE @C INT ,

    @name NVARCHAR(50)

    SELECT @C = COUNT(1)

    FROM #test

    WHILE @C > 0

    BEGIN

    SELECT TOP ( 1 )

    @name = name

    FROM #test

    EXECUTE( 'ALTER SCHEMA my_schema TRANSFER dbo.' + @name);

    DELETE #test

    WHERE name = @name

    SET @C -= 1

    END

    DROP TABLE #test

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply