farax_x
Hall of Fame
Points: 3579
More actions
May 19, 2012 at 12:14 am
#392291
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) ?
May 19, 2012 at 12:21 am
#1490084
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
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