Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to rename user-defined types

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-29 : 07:29:53
Zx writes "Hi,

I would like to know if there is a way to redefine a SQL server user-defined types after it have been used in a database table.

For example, I might have defined a UDT call 'phone' of type nvarchar(7) that is used is a table called address.

However, after months down the road, I have to increase the length to nvarchar(15).

Is there a way to rename the UDT 'phone' without going through each table and updating the type manually?"

Kristen
Test

22859 Posts

Posted - 2005-08-29 : 12:17:56
Do you want to cause all the existing columns, in all the existing tables with the "phone" datatype to change at the same time? If so I'm as good as certain that that isn't going to happen without ALTER TABLE statements for each instance.

If it was me I'd create a "Phone_Version_2" datatype (not necessarily called that), and then migrate the existing columns to the new type, one-by-one.

Kristen
Go to Top of Page
   

- Advertisement -