Skip to main content

- Data Types are attribute that specifies the type of data that a particular column or variable can hold.
- There are various data types some of them are as follows
- INT : Integer data type used to store whole number.
- VARCHAR: Variable length character data type used to store text strings.
- DECIMAL : used to store decimal number with fixed precision and scale.
- DATE: used to store data values
- TIME: used to store time values.
- BOOLEAN: used to store Boolean values (i.e. true or false)
- FLOAT: used to store floating point number.
- CHAR: Fixed length character data type used to store text strings.
- NCHAR: Fixed length Unicode character data type, used to store Unicode character strings.
- MONEY: Data type used to store monetary value with fixed precision of 4 decimal place.
- Difference between char, nchar, varchar and nvarchar
- Char and nchar are fixed length which will reserve storage space for number of characters you specify even if you don't use up all that space.
- Varchar and nvarchar are variable-length which will only use up spaces for the characters you store. It will not reserve storage like char and nchar.
- nchar and nvarchar take up twice as much storage space, so it may be wise to use them only if you need unicode support.
- char and varchar can store maximum of 8000 characters
- nchar and nvarchar can store maximum of 4000 characters
Comments
Post a Comment