Friday, 28 December 2012 13:55

common sql server data types explained

Written by 
Rate this item
(0 votes)

Sql server knows many data types.it's worth our
while to know most common types -

int: use this data type when to store intergers.
This type stores numbers between -2,147,483,648 &
2,147,483,647.

float: use it when you working with large numbers
or small numbers.it can be used for fractions.

money: this data type can be used to store monetary
data like prices for product.its close to int type

datetime: it's used to store dates and times

nvarchar(n): this data type holds strings of text.it's
the most used type because it stores names,details,etc.
the maximum number of characters can be defined.we
need to specify the maximum size in the parentheses.
example - nvarchar(50) defines that a field will
keep up to fifty characters.

nchar(n): in case of storing string its similar to
nvarchar but a data field of the nchar type will
always save strings of the specified size.
so if the string you are saving is shorter than
the size in parentheses,it's padded with the
spaces to until the size specified reached.

Read 1579 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.
Login to post comments