C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






TSQL Datatypes


Posted Date: 11 Sep 2008    Resource Type: Articles    Category: Databases

Posted By: Nagarajan       Member Level: Gold
Rating:     Points: 10



bigint
Range: -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)
Space: 8 Bytes

int
Range: -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)
Space: 4 Bytes

smallint
Range: -2^15 (-32,768) to 2^15-1 (32,767)
Space: 2 Bytes

tinyint
Range: 0 to 255
Space: 1 Byte

bit
Range: 0 (FALSE) or 1 (TRUE)
Space: 8 bit columns in a table, will be collectively stored as: 1 Byte
9 - 16 bit columns in a table, will be collectively stored as: 2 Bytes, etc.
-----------------------------

decimal, numeric
Precision 1 - 9: Storage is 5 bytes
Precision 10 - 19: Storage is 9 bytes
Precision 20 - 28: Storage is 13 bytes
Precision 29 - 38: Storage is 17 bytes
Minimum Precision is 1 and Maximum Precision is 38. The Default Precision is 18.
Note: Decimal is equivalent to Numeric.

money
Range: -922,337,203,685,477.5808 to 922,337,203,685,477.5807
Space: 8 bytes

smallmoney
Range: -214,748.3648 to 214,748.3647
Space: 4 bytes
-----------------------------

float
Range: -1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308
n Value 1 - 24: Precision - 7 digits: Space - 4 bytes
n Value 25 - 53: Precision - 15 digits: Space - 8 bytes

real
Range: -3.40E + 38 to -1.18E - 38, 0 and 1.18E - 38 to 3.40E + 38
Space: 4 bytes
real = Float(24)
-----------------------------

Date and Time
datetime
Range: January 1, 1753, to December 31, 9999
Space: 8 bytes (two 4 byte integers).

smalldatetime
Range: January 1, 1900, to June 6, 2079
Space: 4 bytes (two 2 byte integers).
-----------------------------

char
Space: n number of bytes as declared. valid length 1 to 8,000.

varchar
Space: 1 byte per character + 2 additional bytes. valid length 1 to 8,000.
MAX allows for a much larger maximum storage size (2^31-1 bytes - 2,147,483,647 characters).

text
Maximum 2,147,483,647 characters.
Will be removed in future, Use varchar(max) instead.
-----------------------------

nchar
Space: n * 2 number of bytes. Valid length: 1 to 4,000.

nvarchar
Space: 2 bytes per character + 2 additional bytes. Valid length: 1 to 4,000.
MAX allows for a much larger maximum storage size (2^31-1 bytes - 2,147,483,647 characters).

ntext
Maximum length: 1,073,741,823 characters.
Will be removed in future, use nvarchar(MAX)
-----------------------------

binary
Space: n number of bytes.
Maximum length: 8000 bytes.

varbinary
Space: n number of bytes + 2 additional bytes. Valid length: 1 to 8,000.
MAX allows for a much larger maximum storage size (2^31-1 bytes - 2,147,483,647 bytes).

image
Maximum length is 2,147,483,647 bytes.
Will be removed in future, use varbinary(MAX)
-----------------------------




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
TSQL dateType  .  Tsql datatype range  .  TSQL  .  Datatype  .  Daaatype range  .  

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: JOINS IN SQL-SERVER EXPLAINED
Previous Resource: Creating user defined function in sqlserver database
Return to Discussion Resource Index
Post New Resource
Category: Databases


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use