I have some data that is being enter into the system and sometimes the user will hit an extra key. I need to know how to averge this data so that I will know that the user hit an extra key.

For instance the user normally average anywhere from 20 to 25 snacks a day. So when entering in this data 123 is entered which is an error. I want to flag the error . I am a beginner with Sql so if you could explain I will appreciate.

Who is Participating?
Scott PletcherConnect With a Mentor Senior DBACommented:
You could use a lookup table, with different limits per site, to validate the data.

If you can't specify the limit, how do you expect SQL to know the data is bad??
Scott PletcherSenior DBACommented:
You could add a CHECK constraint on the column, specifying a maximum value that SQL will allow in the column.  For example:

ALTER TABLE dbo.tablename
ADD CHECK(snack_count_column BETWEEN 0 AND 65)

would allow 0 through 65 to be entered for that column's value.
JakiYoungAuthor Commented:
I have 185 sites and the number can vary from site to site.
JakiYoungAuthor Commented:
what about averaging the records
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.