Raj Ali Posted August 30, 2006 Share Posted August 30, 2006 Sir, How to make a user defined data types by query in sql Thanx Raj Ali Link to comment Share on other sites More sharing options...
justsomeguy Posted August 30, 2006 Share Posted August 30, 2006 If you are using SQL Server, this might help:http://www.mssqlcity.com/Articles/General/...e_data_type.htm SQL Server 2000 supports user-defined data types too. User-defined data types provide a mechanism for applying a name to a data type that is more descriptive of the types of values to be held in the object. Using user-defined data type can make it easier for a programmer or database administrator to understand the intended use of any object defined with the data type. The user-defined data types are based on the system data types and can be used to predefine several attributes of a column, such as its data type, length, and whether it supports NULL values. To create a user-defined data type, you can use the sp_addtype system stored procedure or you could add one using the Enterprise Manager. When you create a user-defined data type, you should specify the following three properties:Data type's name.Built-in data type upon which the new data type is based.Whether it can contain NULL values.The following example creates a user-defined data type based on money data type named cursale that cannot be NULL:EXEC sp_addtype cursale, money, 'NOT NULL'Both system and user-defined data types are used to enforce data integrity. It is very important that we put a lot of effort while designing tables: the better you design your tables, the more time you can work without any performance problems. In an ideal case, you never will update the structure of your tables.Wow, I was not aware of this:Use char/varchar columns instead of nchar/nvarchar if you do not need to store unicode data.The char/varchar value uses only one byte to store one character, the nchar/nvarchar value uses two bytes to store one character, so the char/varchar columns use two times less space to store data in comparison with nchar/nvarchar columns.Goodbye nvarchar! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now