Saturday, 9 February 2013

Sql Server DataTypes

SQL Server Data Types Reference

Introduction

 There are plenty of data types to use in SQL Server. Knowing the limitations and benefits of each one will soon pay off. For instance, choosing the tinyint datatype instead of the int datatype for the "ProductType" column with values ranging from 1 to 10 will save three bytes per record. With 100,000 records you will save 300,000 bytes. That's not much in terms of disc space ("storage is cheap, bla bla") but you'll probably have indexes containing that column and if that index takes less memory the engine will process that index much faster in every "join" and "where" etc. So those queries will perform better and use less system resources (memory) which will make the whole server perform better as there will be more resources available for other things. Once learned the datatypes available and spending a few extra minutes when designing your schema will result in faster query execution and a better performing database.

This sheet provides an easy reference to look up limitations and benefits for each SQL Server data type.

The Data types reference sheet

The columns 8, 9, 10 shows what versions of SQL Server that supports the data type
  • 8 = SQL Server 2000
  • 9 = SQL Server 2005
  • 10 = SQL Server 2008

1 comment:

Unknown said...

Nice post very helpful

dbakings