May 19, 2012 at 12:14 am
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
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
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy