Solved

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.

Posted on 2014-04-30
4
172 Views
Last Modified: 2014-05-14
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.

Thanks
0
Comment
Question by:JakiYoung
  • 2
  • 2
4 Comments
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 40032656
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.
0
 

Author Comment

by:JakiYoung
ID: 40032784
I have 185 sites and the number can vary from site to site.
0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 40032870
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??
0
 

Author Comment

by:JakiYoung
ID: 40032878
what about averaging the records
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question