Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sql server: alias data type

Posted on 2011-02-24
4
Medium Priority
?
667 Views
Last Modified: 2012-05-11
i have this code
CREATE TYPE ShortDescription
FROM nvarchar(10) NOT NULL ;

create table miTabla
(id int identity,
 observacion ShortDescription)

MyTable table has 10,000 rows.
  I need to change shortDescription to nvarchar (12), as I can do?
0
Comment
Question by:enrique_aeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 34969930
Alter Table TableName
Alter column modify Columnsname DataType
0
 

Author Comment

by:enrique_aeo
ID: 34970162
I change the column observacion , but it uses an alias data type, as I can modify the alias data type?
0
 
LVL 57

Assisted Solution

by:Raja Jegan R
Raja Jegan R earned 500 total points
ID: 34971081
>> but it uses an alias data type, as I can modify the alias data type?

You can't modify a data type as it is not available per Design.
Instead the options available for you are

1. DROP TYPE and then CREATE TYPE back. But this will impact all existing tables with those types
2. ALTER TABLE to change datatype of that column to Varchar(12)

ALTER TABLE miTabla ALTER COLUMN observacion varchar(12);
0
 
LVL 9

Accepted Solution

by:
sarabhai earned 500 total points
ID: 34971227
The only way to alter a User Defined Data Type is to create a new User Define Data Type (UDDT), and change out all existing column to that UDDT, then you can drop the original one, and recreate it and change out the change you made previously.  The problem is that you can't drop the UDDT if it is in use.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question