Hello,
I am storing lattitude in sql server as below format like 12°20'30". But now i want to split the lattitude in sql server like 12 DEG 20 MIN 30 SEC. Please provide me the solution
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jefferson S. MottaPosted Feb 9, 2019, 6:50 AM
select substring('12°20''''30"',1,2) + ' DEG ' as fld1,
substring('12°20''''30"',4,2) + ' MIN ' as fld2,
substring('12°20''''30"',8,2) + ' SEC' as fld3) t;
select substring(YOURFIELD,1,2) + ' DEG ' as fld1,
substring(YOURFIELD,4,2) + ' MIN ' as fld2,
substring(YOURFIELD,8,2) + ' SEC' as fld3) t
select substring('12°20''''30"',1,3) as fld1,
substring('12°20''''30"',4,3) as fld2,
select substring(YOURFIELD,1,3) as fld1,
substring(YOURFIELD,4,3) as fld2,
substring(YOURFIELD,8,3) as fld3;