Header Ads

User Defined Data Types In SQL Server

User defined data types is useful to maintain the data type consistency in the database design. For example Phone Number is a field in several tables. These tables are may be created by several people in the team. All are may be use nvarchar as data type for Phone Number but length may be vary..to overcome these kind of issues we can use this feature.

Example:

Create Type [dbo].[PhoneNumber] from [nvarchar](12) NULL

Create table Employees (

Email nvarchar(50),
Phone PhoneNumber

)

In the above example PhoneNumber is a user defined data type.

2 comments:

  1. That is an extremely smart written article. I will be sure to bookmark it and return to learn extra of your useful information. Thank you for the post. I will certainly return.

    ReplyDelete

Powered by Blogger.