How do I validate 15 minute intervals using SQL

I have data stored in minutes in a column called 'MYTIME'.  The values can range from 1 to 1440 but I have one customer who wants to validate that that the value entered is in a 15 minute interval.  
So the values 15, 30, 45, 60, 75, 90, 105 etc, etc up tp 1440 would all be valid.

Is there a simple SQL that I can run to validate the column has the right interval?

Thanks
hmstechsupportAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
you have several options:
* store all the possible values in a "lookup table", and make the field a foreign key to that table
* make a check constraint that mytime % 15 = 0


0
knightEknightCommented:
This will pull the rows where the time is not one of those values:


; with cte as (
  select 0 as interval
  union all
  select interval+15
  from cte
  where interval < 1440
)

select *
from myTable
where MYTIME not in (select interval from cte)
0
hmstechsupportAuthor Commented:
After doing a little checking wouldn't this work?

SELECT MYTIME FROM MYTABLE WHERE MYTIME % 15 <> 0
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Anthony PerkinsCommented:
It really depends on your definition of "validate".  If you post in this zone, we assume you want a database constraint and that is what angelIII gave you here http:#a35335381.  But it sounds like what you really are looking for is a presentation level validation, if so than you are correct.
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I confirm that visibly you wanted to query for those that don't match, and not yet set up a method to avoid (future) entries to confirm to the "constraint".
0
hmstechsupportAuthor Commented:
Thanks to all of you, and my apologies if the question was not clear enough or posted in the wrong zone.
0
hmstechsupportAuthor Commented:
The answer I was looking for was devised by me after looking in other sites.
The answers given may be accurate but they do not address my question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.