Difference between using integer and numeric types | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Difference between using integer and numeric types

What is the difference between using an integer and a numeric data type? Also, which is best for storing information such as social security numbers. Can some give examples of when it is best to use numeric or either integer? Thanks.
Numberic there is a decimal part. numeric[(p[, s])] which integer does not have
for social security number you can use varchar
quote:Originally posted by artfuldodger What is the difference between using an integer and a numeric data type? Also, which is best for storing information such as social security numbers. Can some give examples of when it is best to use numeric or either integer? Thanks.

Both the datatypes data consists of numbers only. Numeric data includes positive and negative numbers, decimal and fractional numbers, and whole numbers. BOL defines:
Be careful when choosing the base types for implementing user-defined data types. For example, in the United States, Social Security numbers have a format of nnn-nn-nnnn. While Social Security numbers contain numbers, the numbers form an identifier and are not subjected to mathematical operations. It is therefore common practice to create a user-defined Social Security number data type as varchar and create a CHECK constraint to enforce the format of the social security numbers stored in the table
Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Check the last reply by Joe Celko in this thread:<br /<a target="_blank" href=http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=9&messageid=155936&p=4>http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=9&messageid=155936&p=4</a><br />Might give some very useful information on SSN.<br /><br />After reading this, I don’t think you would want to go with neither INTEGER nor DECIMAL (NUMERIC) [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br />–<br />Frank Kalis<br />SQL Server MVP<br /<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a><br />
Hi FrankKalis,
Access is denied to given link.

Oops, sorry, forgot, you must a member of SSC. But membership is free [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br />–<br />Frank Kalis<br />SQL Server MVP<br /<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a><br />
]]>