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
170 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:ScottPletcher
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:
ScottPletcher 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now