Solved

sql server: alias data type

Posted on 2011-02-24
4
666 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 125 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 125 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

615 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