How do you change or alter a user defined data type?

  • Hi

       I want to make change in user defined datatype ?

    Could u pls help me to do ?

     

    Regards

    Jones

     

  • Here's what my research yielded:

    Unfortunately, there is no easy way to alter or modify a user defined data type. To modify a user defined data type, follow these steps:

    * Alter all the tables, that are referencing this user defined data type (UDT), using ALTER TABLE...ALTER COLUMN command and change the data type of the referencing column to an equivalent (or the intended) base data type.

    * Drop the user defined data type using sp_droptype.

    * Recreate the user defined datatype with the required changes using sp_addtype.

    * Again, use the ALTER TABLE...ALTER COLUMN syntax to change the column's datatype to the user defined data type.







    **ASCII stupid question, get a stupid ANSI !!!**

  • Hi Rookie

           Thank You for the suggestions.But i thought there might be some other solutions.

     I Feel this makes little over head . The purpose of Creating user defined type is easy for maintainable . but in this case it fails to make it

    is there any other technique to map a table column to a variable ?

     Suppose i have table Employee and its column Eno integer.

    is it possible to declare a variable sno as Employee.Eno ?

     

    Regards

    Jones

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

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