top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

User Defined Data Types in SQL Server?

+5 votes
61 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 Google+ Share Button LinkedIn Share Button Multiple Social 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...