Call now: (800) 766-1884  



 Home


 SQL Server Tips
 SQL Server Training

 SQL Server Consulting
 SQL Server Support
 SQL Server Remote DBA



 Articles
 Services
 SQL Server Scripts
 Scripts Menu



 

 

 

   
  SQL Server Tips by Gama and Naughter


Data types for code and data structure use

 

Most data types will work with both variable declarations in TSQL and column data. The following table lists them:

 

SQL Server data type

Description

 

SQL Server data type

Description

Binary

 

Decimal (=Numeric)

binary

Binary data, length 1 to 8000 bytes. Padded on the right with zeros.

 

decimal, numeric

Fixed precision and scale numbers (precision=number of digits, scale=number of decimal places). 5 to 17 bytes of storage.

varbinary

Variable-length binary data, length 1 to 8000 bytes.

 

Floating point

Char ASCII

 

real

4-byte real, 24 bits for the mantissa in scientific notation.

char

Character data, length 1 to 8000 bytes. Padded on the right with spaces.

 

float

4 or 8-byte float, 24 or 53 bits for the mantissa in scientific notation.

varchar

Variable-length character data, length 1 to 8000 bytes.

 

Date/Time

Char Unicode

 

datetime

8-byte datetime data.Number of 1/300 seconds since January 1, 1753.

nchar

Character data, length 1 to 8000 bytes. Padded on the right with spaces.

 

smalldatetime

4-byte smalldatetime data. Numer of minutes since January 1, 1900.

nvarchar

Variable-length character data, length 1 to 8000 bytes.

 

Money

Integer (signed, except tinyint)

 

smallmoney

4-byte monetary data with accuracy to a 1/10000. Internally, a 4-byte integer multiplied by 10000.

tinyint

1-byte integer.

 

money

8-byte monetary data with accuracy to a 1/10000. Internally, an 8-byte integer multiplied by 10000.

smallint

2-byte integer.

 

Blob

Int

4-byte integer.

 

image

Binary data, variable length up to 2,147,483,647 bytes.

bigint

8-byte integer.

 

text

ASCII data, variable length up to 2,147,483,647 bytes.

Boolean

 

ntext

Unicode data, variable length up to 2,147,483,647 bytes.

Bit

Bit (0 or 1).

 

sql_variant

Variant, can take any other data type except text, ntext, image, timestamp.

 

Table 26.1 data types

 

Note: All data types are NULL by default and will accept a NULL value assignment.


The above book excerpt is from:

Super SQL Server Systems
Turbocharge Database Performance with C++ External Procedures

ISBN: 0-9761573-2-2
Joseph Gama, P. J. Naughter

 http://www.rampant-books.com/book_2005_2_sql_server_external_procedures.htm
 

 

Burleson Consulting Remote DB Administration


 

 


 

 

 

 

 
Burleson is the America's Team

Note: The pages on this site were created as a support and training reference for use by our staff of DBA consultants.  If you find it confusing, please exit this page.

Errata?  SQL Server technology is changing and we strive to update our SQL Server support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:and include the URL for the page.
 


Burleson Consulting
SQL Server database support

 

Copyright 1996 -  2013 by Vaaltech Web Services. All rights reserved.

Hit Counter