Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Can some tell me how to transfer schema of "User Defined Table Type" (UDTT) in SQL 2008?


Can some tell me how to transfer schema of "User Defined Table Type" (UDTT) in SQL 2008?

Author
Message
Vincy-856784
Vincy-856784
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 70
I have cloned a database from another database and able to change the schema for all the objects except the UDTTs. Now I got stuck here. I know I can do it manually by removing the reference from the dependent objects and dropping the UDTT and re-creating with the new schema. But it is too cumbersome and I am pretty sure there should be a better way of doing this.

So, I thought some of you might have that better answer for me.

I greatly appreciate your quick and generous answer/help.

Thanks,

Vincent
Steve Jones
Steve Jones
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: Administrators
Points: 41808 Visits: 18876
Use ALTER SCHEMA, with the type::schema.object


http://msdn.microsoft.com/en-us/library/ms173423.aspx

CREATE SCHEMA OldSchema
;
GO
CREATE SCHEMA NewSchema
;
GO
CREATE TYPE OldSchema.MyTable AS TABLE
( IDCode INT
, Location VARCHAR(200)
)
;

CREATE PROCEDURE OldSchema.MyProc AS SELECT * FROM dbo.MyLogger
;


ALTER SCHEMA NewSchema TRANSFER OldSchema.MyProc
;
ALTER SCHEMA NewSchema TRANSFER type::OldSchema.MyTable
;
GO



Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Vincy-856784
Vincy-856784
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 70
Thank you for the very detailed response. It worked perfectly. The trick was "type::", that is what I didn't know about... :-)
Steve Jones
Steve Jones
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: Administrators
Points: 41808 Visits: 18876
You are welcome, and it's not well documented from what I can see.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search