Always Create User Defined Data Types in the Database

Always Create User Defined Data Types in the Database

While designing the database for your application, you should always create user defined data types for columns across the database. User-defined data types ensure consistency of column definitions across the database. User-defined datatypes are defined in terms of system datatypes. User-defined datatypes permit frequently used type information to be accessed by a name you choose with a specified rule, default, and display format attached to it. You can create a User-defined datatype using the sp_addtype system stored procedure. You need to create a User-defined datatype before it can be used in a table definition.

Here is an example that creates a user-defined datatype which is based on intrinsic datatype datetime named DateOfBirth that allows null values.

sp_addtype DateOfBirth, datetime, ‘NULL’


About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist