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
 General SQL Server Forums
 New to SQL Server Administration
 Correct Data Type Issue

Author  Topic 

tinamiller1
Yak Posting Veteran

78 Posts

Posted - 2015-02-13 : 16:31:30
I have two tables that I am trying to find the correct data type for. I have tried plain numeric, int and varchar. They all do the same thing except the numeric when I average it gives me back 1.

The first table looks like this: (It was a yes no in Access but cannot do that in SQL Server)
eligible,compliant,noncompliant
1,0,0
1,1,1
1,0,1
1,0,1
1,0,0
1,0,1

The second table is:
target,reached,converted
150000,2500,150
1500,300,12
300,17,2

The target is an aggregation of those members in our target pool. The reached are those we actually contacted could be text, phone, email. The converted are those we reached and had an incoming claim for. We might have called someone and said hey time for your breast cancer screening and then we checked and you had a claim that came in for a mammogram

I am asking because the front-end tool I am using over sums everything. Yes this could be a front-end tool issue but I want to address on here the correct datatype.

tina m miller

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-02-13 : 16:34:46
I would use bit for the first table, all 3 columns. I would use one of the integer data types, probably int. Lookup tinyint, smallint, int and bigint to determine which data types makes sense for each column in the second table.

If the sums are not coming out right, then the issue is with the calculation, not the data type.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -