SQL Server 2000 Data Types
SQL Server 2000 Data Types

SQL Server Requires That Each Variable And Column In A Table Should Be Defined With Respect To The Type Of Data It Will Store. From A Bit To A Huge Image And Binary Storage Types, The Allocation Is Supposed To Help The User Conform To The Data Required, And Help The Engine Allocate Space And Processing Speed Efficiently. Built-in Data Types SQL Server 2000 Recognizes The Following Built In Data Types: Data Types Description Bigint Integer Data From -263 Through 263-1 Int Integer Data From -231 Through 231 - 1 Smallint Integer Data From -215 Through 215 - 1 Tinyint Integer Data From 0 Through 255 Bit Integer Data With Either A 1 Or 0 Value Decimal Fixed Precision And Scale Numeric Data From -1038 1 Through 1038 -1 Numeric Fixed Precision And Scale Numeric Data From -1038 1 Through 1038 -1 Money Monetary Data Values From -263 Through 263 - 1 Smallmoney Monetary Data Values From -214,748.3648 Through 214,748.3647 Float Floating Precision Number Data From -1.79E 308 Through 1.79E 308 Real Floating Precision Number Data From -3.40E 38 Through 3.40E 38 Datetime Date And Time Data From January 1, 1753, Through December 31, 9999, With An Accuracy Of 3.33 Milliseconds Smalldatetime Date And Time Data From January 1, 1900, Through June 6, 2079, With An Accuracy Of One Minute Char Fixed-length Character Data With A Maximum Length Of 8,000 Characters Varchar Variable-length Data With A Maximum Of 8,000 Characters Text Variable-length Data With A Maximum Length Of 231 - 1 Characters Nchar Fixed-length Unicode Data With A Maximum Length Of 4,000 Characters Nvarchar Variable-length Unicode Data With A Maximum Length Of 4,000 Characters Ntext Variable-length Unicode Data With A Maximum Length Of 230 - 1 Characters Binary Fixed-length Binary Data With A Maximum Length Of 8,000 Bytes Varbinary Variable-length Binary Data With A Maximum Length Of 8,000 Bytes Image Variable-length Binary Data With A Maximum Length Of 231 - 1 Bytes Cursor A Reference To A Cursor Sqlvariant A Data Type That Stores Values Of Various Data Types, Except Text, Ntext, Timestamp, And Sqlvariant Table A Special Data Type Used To Store A Result Set For Later Processing Timestamp A Database-wide Unique Number That Gets Updated Every Time A Row Gets Updated Uniqueidentifier A Globally Unique Identifier Bigint, Sqlvariant, And Table Are New To SQL Server 2000 User-defined Data Types You Can Make User-defined Data Types Too, Which Sometimes Can Be More Descriptive Of The Value Types Held In The Object. This May Make It Easier For The Programmer To Document And Work With The Data. These Data Types Are Based On The Built In Types, And Can Be Outfitted With Preprogrammed Defaults, Checks, Constraints, Etc. . To Create A User-defined Data Type, Use Spaddtype Datatypename, Basedatatype, NULL''NOT NULL' How To Choose The Appropriate Data Type SQL Server Stores Data In Data Pages That Are 8Kb (8192 Bytes) In Size. The System Uses Some Of That S Sometimes, The System Uses Only 8060 Bytes Are Availableto That Are Available To Store User's Data. Consider The Size Of A Row Of Data In Your Tables. If The Rows Are Large, Make Sure That Multiples Of The Fit Conveniently On A Data Page So That Page Space Is Not Wasted. This Is Cut Down On Disk Paging Overhead When Accessing The Data. You Want To Maximize The Number Of Rows Of Data Which That Will Fit On A Page. This Can Be Accomplished Both By Splitting The Tables, And By Choosing The Smallest Data Type Which That Will Accommodate Your Data. . In You Are Using Integer Data, Data; Consider That The Tinyint Datatype Will Accommodate Data Which That Will Fit Into One Byte Of Storage. So If The Range Of All Of The Data In Your Field (or Variable) Is Between 0 And 255, Use The Tinyint Datatype. If The Range Is Between -32,768 And 32,767, Use The Smallint Data Type. And If If You Need To Store Integer Data From -2,147,483,648 Through 2,147,483,647, Use Int Data Type. Similarly With Smallmoney. If Smallmoney. If Your Value Range Is Between -214748.3648 And 214,748.3647, Use The Smallmoney Datatype. Use Smalldatetime Data Type Instead Of Datetime Data Type, If You Need To Store The Date And Time Data From January 1, 1900 Through June 6, 2079, With Accuracy To The Minute. Prefer Varchar.nvarchar To Textntext Whenever Possible Because The Text And Image Fields Are Stored Separately, Which Produces Additional Paging. And Prefer Charvarchar To Ncharnvarchar Data Types Because The N Types Require Twice As Much Storage Space. The N Types Are Used Primarily For Unicode Data. Resources Tutorial: SQL 7 Database Files This Is A Useful Tutorial On SQL And Database Files. Information: Complete Information On SQL This Resource Provides Complete Information On SQL. Metro NY NJ SQL Server ConsultantsWe Specialize Is Custom Database Software. Call Us For A Free Consultation (973) 635 0080 Or Email Us At Paladn.com