C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » Databases »

Data Types in SQL Server.


Posted Date: 20 Jun 2009    Resource Type: Articles    Category: Databases
Author: Ashok Babu KandulaMember Level: Diamond    
Rating: 1 out of 5Points: 10



Data types and their ranges are as below

Integer.............

1) Bit - A column of bit data type can store 0, 1 or Null.
If a table has only one bit column then it occupies one full byte. Up to 8 bit columns are stored in a single byte.
2) Tinyint - Can store values 0-255 or null value (1 byte for storage ).
3) Smallint - Can store values -32768 to 32767 or null ( 2 bytes for storage ).
4) Int - Can store values -2 power 31 to 2 power 31 - 1 or null ( 4 bytes for storage ).
5) Bigint - Can store values - 2 power 63 to 2 power 63 - 1 ( 8 bytes for storage ).

TEXT................

1) Char - This data type is used to store non Unicode characters. It holds a fixed number of characters. Maximum size is 8000 characters.
Ex: Fname char (20). Will always store 20 character even if the value stored is less than 20 character.
2) Varchar - It is used to store non-Unicode characters. It holds variable length of characters. Maximum size is 8000 characters.
3) Text - It is used to store extremely large non-Unicode data. It automatically varies in length in accordance to the data stored. Maximum size is 2 power 31 - 1 characters.
4) nChar - This is similar to char data type but it is used to store Unicode data type. Maximum size 4000 characters.
5) nVarchar - This is similar to varchar data but is used to store Unicode data type. Maximum size 4000 characters.
6) nText - This is similar to text data type but it is used to store Unicode data type. Maximum size 2 power 30 - 1 characters.

Decimal : A column of this data type can handle exact floating point numbers without rounding off. SQL SERVER provides 2 data type DECIMAL and NUMERIC. These 2 data types should specify both the precision and scale values.
Precision: - Total number of digits to be stored.

Scale: - Number of digits that can be stored to the right of the decimal point.
Example:- Dec (8,2 ) can store values -999999.99 to 999999.99




Responses

Author: Manigandan    22 Jun 2009Member Level: Gold   Points : 0
Types of Integer


Author: Milind Kansagara    24 Jun 2009Member Level: Gold   Points : 0
Nice One


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
TEXT  .  SQL Server  .  Scale  .  Precision  .  Integer  .  Decimal  .  Data Types  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: SQL Indexes
Previous Resource: Difference between STUFF function and Replace Function in SQL ?
Return to Discussion Resource Index
Post New Resource
Category: Databases


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use