MohitPandit
asked on
SQL Server: How to validate Latitude & Longitude value is valid
Hello Folks,
I've one table which contains Latitude & Longitude for each record.
Is there any ways to validate Latitude & Longitude value valid or not?
Best Regards
I've one table which contains Latitude & Longitude for each record.
Is there any ways to validate Latitude & Longitude value valid or not?
Best Regards
ASKER
Should it be >= -90 and <=90 i.e. greater than equal to 90 and less than equal to 90?
Apart, do you have any URL for this rule?
Apart, do you have any URL for this rule?
No, I don't have. But you can get many if you simply type valid latitude longitude values on google.
Here is the fixed check constraints for that.
Here is the fixed check constraints for that.
create table x (
id int not null,
latitude float CHECK (latitude >= -90 and latitude <= 90),
longitude float CHECK (longitude >= -180 and longitude <= 180))
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
Walter Ritzel,
Did not intend to steal the points from your very valid answer.
I am sorry about that.
Anthony
Did not intend to steal the points from your very valid answer.
I am sorry about that.
Anthony
Anthony Perkins, no problem at all, man.
So, you can create check constraints on your fields.
Open in new window