Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 integer or character column?

Author  Topic 

keen1
Starting Member

21 Posts

Posted - 2003-08-14 : 03:52:37
i have a product identity like 'xxxxxxxx.xx' where the all the 'x's are digits and there is a '.' character between the two parts.

i have to make the decision on how to put this identity in the master product table.
One of my collegues adviced to use two seperate integer columns for the two parts and when there is a need to put this id on a UI, query the two columns, formatting them in the query to show 'xxxxxxxx.xx'

Queries using this id data will generally use it in the 'where clause' of the query like :
'WHERE COIL_ID='14356711.12''
or 'WHERE COIL_ID1=14356711 AND COIL_ID2=12'

or like:
'SELECT COIL_ID WHERE START_TIME > @ProdStartTime AND FINISH_TIME > @ProdFinishTime '
or 'SELECT COIL_NO=COIL_ID1 + ' ' + COIL_ID2 WHERE START_TIME > @ProdStartTime AND FINISH_TIME > @ProdFinishTime '

Can anyone advise on the efficient way of implementing this?

mr_mist
Grunnio

1870 Posts

Posted - 2003-08-14 : 04:10:51
I'd go with splitting them into two integer fields (or one int and one smallint). It seems as though they are two distinct objects and should be treated as such, and it will give better performance than concatinating / splitting columns and such for joining.

-------
Moo. :)
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-08-14 : 07:22:59
split them!!

- Jeff
Go to Top of Page
   

- Advertisement -