<feed xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
    <title>Emad Mokhtar</title>
    <link rel="self" type="application/xml" href="http://geekswithblogs.net/EmadTech/Atom.aspx" />
    <subtitle type="html"> </subtitle>
    <id>http://geekswithblogs.net/EmadTech/Default.aspx</id>
    <author>
        <name>Emad Mokhtar</name>
        <uri>http://geekswithblogs.net/EmadTech/Default.aspx</uri>
    </author>
    <generator uri="http://subtextproject.com" version="Subtext Version 0.0.0.0">Subtext</generator>
    <updated>2009-08-17T19:59:04Z</updated>
    <entry>
        <title>SQL Server 2008 Data types Part1</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/EmadTech/archive/2009/08/17/sql-server-2008-data-types-part1.aspx" />
        <id>http://geekswithblogs.net/EmadTech/archive/2009/08/17/sql-server-2008-data-types-part1.aspx</id>
        <published>2009-08-17T19:59:0403:00:00</published>
        <updated>2009-08-17T19:59:04Z</updated>
        <content type="html">&lt;p&gt;&lt;font size="2" face="Verdana"&gt;Hello Folks,&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Verdana"&gt;Today I'll will mention the Microsoft SQL Server 2008 Fileds data types, you need to choose the right data type for the database fileds for more speed efficency, and i think the most important thing the fundamental of the database itself.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Verdana"&gt;Let's begin:&lt;/font&gt;&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;char:&lt;/strong&gt;&lt;/u&gt; the char datatype is ifxed in length, if you enter fewer that than the number of character defined the remaining length will be space filled to the right; use this data type when the column dat is to be of fixed length, which tends to be the case foe customer IDs and bank account IDs.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;nchar:&lt;/strong&gt;&lt;/u&gt; the nchar type is exactly like char, but will hold characters in unicode formate rather than ANSI; infact SQL Server allocates double the space internally, so unless there is a need in your database to hold this type of character, it's easier to stick with ANSI.&lt;/font&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;font size="2" face="Verdana"&gt;Note: &lt;/font&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;font size="2" face="Verdana"&gt;ANSI character sets only hold up to 256 char.&lt;/font&gt;&lt;/li&gt;
            &lt;li&gt;&lt;font size="2" face="Verdana"&gt;Unicode character sets only hold up to 65,536 chr.&lt;/font&gt;&lt;/li&gt;
        &lt;/ul&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;varchar:&lt;/strong&gt;&lt;/u&gt; the varchar data type holds alphanumeric data; just like char but with flexible size, you just set the maximum number of characters, maximum size is 8,000 character.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;nvachar:&lt;/strong&gt;&lt;/u&gt; it's defined in samilier way to varcar but it uses unicode.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;text:&lt;/strong&gt;&lt;/u&gt; the text data type holds data is longer than 8,000.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;ntext:&lt;/strong&gt;&lt;/u&gt; sae as text type, but holde unicode.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;image:&lt;/strong&gt;&lt;/u&gt; is very much like text data tybe, expect it's for any type of binary data, like images, movies, or music.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;int:&lt;/strong&gt;&lt;/u&gt; the integer data type is used for holding a anumeric values that don't have any deciaml point, it's rang is between -2,147,483,648 adn 2,147,483,674.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;strong&gt;&lt;u&gt;bigint:&lt;/u&gt;&lt;/strong&gt; the bidint or big integer data type same as int but with larger rang, it's rang is between -9,223,372,036,854,77,808 and 9,223,372,036,854,77,807.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;smallint:&lt;/strong&gt;&lt;/u&gt; the smallint data type is samilar to int but with smaller rang, it's rang is between -32,768 to 32,767.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;tinyint:&lt;/strong&gt;&lt;/u&gt; it's  samller  than smallint data type.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;decimal/numeric:&lt;/strong&gt;&lt;/u&gt; both the decimal and numeric data types hold the same rang of data from -10 to the power 38+1 to 10 to he power 38-1.&lt;/font&gt;&lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;float:&lt;/strong&gt;&lt;/u&gt; it's used for numbers where the decimal point isn't fixed, it's rang is between -1.79e+308 to 1.79e+308&lt;/font&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;font size="2" face="Verdana"&gt;Warning:&lt;/font&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;font size="2" face="Verdana"&gt;The values can't always be seen as 100% accurate, as they can be approximate "Rounded".&lt;/font&gt;&lt;/li&gt;
        &lt;/ul&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;font size="2" face="Verdana"&gt;&lt;u&gt;&lt;strong&gt;real:&lt;/strong&gt;&lt;/u&gt; it's like float data type but with wider rand, it's rang between -3.40e+38 to 3.40e+38, and still hold approximate value also.&lt;/font&gt;
    &lt;div align="left"&gt;&lt;/div&gt;
    &lt;/li&gt;
&lt;/ol&gt;&lt;img src="http://geekswithblogs.net/EmadTech/aggbug/134148.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/EmadTech/comments/134148.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/EmadTech/comments/commentRss/134148.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/EmadTech/services/trackbacks/134148.aspx</trackback:ping>
    </entry>
</feed>
