should we use float as primary key in sql-server

primary-key, sql, sql-server-2008

Solution

Considerations:

- you CAN make a float field primary key.

- you CANT make a float field IDENTITY. Identity columns must be of data type int, bigint, smallint, tinyint, or decimal or numeric with a scale of 0

- you ABSOLUTELY SHOULD NOT use a float field as a PK. Again, you CAN, SQL Server will allow you but its not recommended mainly because floats are inaccurate as @Andy said.

why do you need a float as a PK anyway? Do you need a value like 3,1234235234534 to uniquely identify your row?

Problem

some one suggested me its a better idea to use float as a primary key of a table instead of using the BIGINT. can we make float primary key to be identity ?

Original source