Upload
nigel-foulkes-nock
View
25
Download
2
Embed Size (px)
Citation preview
Confidential 29th January 2016 5
Examples of Inappropriate DataTypes – page 1 of 2
Integer Datatype
ColumnName Example Datatype Range Bytes Suggestion Bytes
LoanDuration 24 INT +- 2,147,483,648 4SMALLINT 2
PartitionMonth 7INT +- 2,147,483,648 4TINYINT 1
Numeric Datatype
ColumnName Example Datatype Range Bytes Suggestion Bytes
LoanAmount 16000NUMERIC(18,2) precision 10-19 9… (9,2) 5
UnitCost 12999NUMERIC(18,2) precision 10-19 9… (9,2) 5
Confidential 29th January 2016 6
Examples of Inappropriate DataTypes – page 2 of 2
Date Datatype
ColumnName Example Datatype Range Bytes Suggestion Bytes
ApplicationDate DateTime1753-01-01 00:00:00.000 - 9999-12-31 00:00:00.000 4SMALL DATETIME 2
DateOfBirth 19991103DateTime1753-01-01 00:00:00.000 - 9999-12-31 00:00:00.000 8DATE 3
Character Datatypes
ColumnName Example Datatype Range Bytes Suggestion Bytes
MonthName January NCHAR(50)A-Z plus Unicode variance values 100VARCHAR(10) 10
Confidential 29th January 2016 8
Smaller Data size, less Data CacheingFaster, smarter, more efficient
Confidential 29th January 2016 10
Identifying the Issue – Check your tablessp_help ‘schemaname.tablename’
e.g.
sp_help ‘dbo.TableAdmin’
sp_spaceused ‘schemaname.tablename’
Confidential 29th January 2016 11
References
http://www.techrepublic.com/blog/10-things/10-plus-common-questions-about-sql-server-data-types/
http://www.connectionstrings.com/sql-server-data-types-reference/