top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

User Defined Data Types in SQL Server?

+5 votes
484 views

Are there User Defined Data Types in SQL Server? How can we create and use them?

posted Mar 27, 2014 by Muskan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+3 votes
 
Best answer

Creating UTD:

Method#1:

CREATE TYPE PhoneNr FROM VARCHAR(13)
DROP TYPE PhoneNr

Method#2:

sp_addType PhoneNr, 'VARCHAR(13)'
sp_droptype PhoneNr

Usage

CREATE TABLE PersonalInfo ( PersonID INT, PersonNm VARCHAR(100), Phone PhoneNr)
answer Mar 28, 2014 by Asmita Agrawal
...