[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
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
Medium Priority
?
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 70

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 70

Accepted Solution

by:
Scott Pletcher earned 2000 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

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…
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

650 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