Reverse Lat Long to Long Lat in T-SQL [closed] - tsql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have been given MYSQL spatial data in CSV format. The geometry field contains the Latitude and Longitude values but I need to swap it to Longitude and Latitude in that order, so I can view this in TSQL as well known text. Is this possible to convert?
e.g.
-38.24915 145.04892, -38.24912 145.0488, -38.24903 145.04883, -38.24906 145.04895
needs to be
145.04892 -38.24915, 145.0488 -38.24912, 145.04883 -38.24903, 145.04895 -38.24906
Thanks

For fun I put together a SQL Server 2017 solution. This may help you get you started.
DECLARE #yourstring varchar(1000) =
'-38.24915 145.04892, -38.24912 145.0488, -38.24903 145.04883, -38.24906 145.04895';
SELECT STRING_AGG(SUBSTRING(item,11,100) + ' ' + SUBSTRING(item,1,10),', ')
FROM
(
SELECT item = TRIM([value])
FROM STRING_SPLIT(#yourstring,',')
) split1;
Returns:
145.04892 -38.24915 , 145.0488 -38.24912 , 145.04883 -38.24903 , 145.04895 -38.24906

Related

How do I use explode after NOT IN in this query [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
$sql=" SELECT *
FROM mt_volunteer_shift
WHERE volunteer_shift_sale_id =".$value['registered_sale_sale_id'] . "
AND volunteer_shift_id NOT IN".$value['registered_sale_volunteer_id'];
$query = $this->db->query($sql);
$active_volunteer = $query->result_array();
For example You can use like below format.
$registered_sale_volunteer_id= explode(',', $variable);
$sql= "SELECT * FROM mt_volunteer_shift WHERE volunteer_shift_sale_id =".$registered_sale_sale_id ."
AND volunteer_shift_id NOT IN (".$registered_sale_volunteer_id.")";

Convert array into comma separated value of String [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have an array and I want to convert it into String but separated each element by '","
List<String> list = ["India","China","USA"];
var string = list.join(',');
print(string); //output = "India,China,USA"

How do I sum the "money" values in the Foreach loop in my project with Swift? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I created a loop with foreach. My data is coming through firebase. How do I sum the "money" values in the Foreach loop in my project with Swift? Please help!
TODOS.swift / Image
IncomeList.swift / Image
Text(String("\(self.session.items.map({ $0.money }).reduce(0, +))"))
could you try insert above code below "List {" code line in "TODOS.swift / Image"?

How to search for a duplicate in a given string using scriptlet? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
How can I search for a duplicate in a given string using a scriptlet?
ScripletInput= a,b,c,a
Here the letter 'a' is repeating. If it is repeating more than once, then it should exit, else it can go ahead.
Please see Remove occurrences of duplicate words in a string
The code below will remove duplicates in a string.
<script type="text/javascript">
str=prompt("Enter String::","");
arr=new Array();
arr=str.split(",");
unique=new Array();
for(i=0;i<arr.length;i++)
{
if((i==arr.indexOf(arr[i]))||(arr.indexOf(arr[i])==arr.lastIndexOf(arr[i])))
unique.push(arr[i]);
}
unique.join(",");
alert(unique);
</script>

How do I create a Lookup table in Powershell? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a list of servernames
PARDC1 EURDC2 EURDC3 USADC1 USADC22 CHNDC1 CHNDC2
I have created a hashtable to pick the first 3 letters of servernames, and classify it in a region.
PAR = EMEA
EUR = EMEA
USA = NAM
CHN = APAC
I want to use the lookup table to classify all servers in appropriate regions.
How do I go about doing this in Powershell ?
You can create an empty hash table with
$hash = #{}
You can then add entries to it with
$hash['foo'] = $bar
or
$hash.foo = $bar
and access them the same way later again.