One of those days... Yes, I need to update records that exist in the Customer table with the cooresponding record in the Contact table.... Sorry about that...
Basically, just ran it as you described above...
Insert Into Customer(Id, y_coordinate, x_coordinate)
Select Customer_ID,
Left(Contact_Point, CharIndex(',', Contact_Point) - 1),
LTrim(Right(Contact_Point, Len(Contact_Point)) - CharIndex(',', Contact_Point))
From Contact
Where...
Yes, the data should be fine. However, in double checking everything I see the concatenated data has the x and y coordinates reversed. Contact_point was entered as "latitude,longitude" whereas the standard convention is x coordinate is longitude and the y coordinate is latitude. Therefore...
Just noticed. It does need to select only records in Contact where the field 'First' has the code GPS only.. Records without the code GPS in 'First' would not be processed..
Thanks for the help... MichaelF81, you are correct about the concatenated data is in the field 'Contact_Point' and then need to be split at the comman into the Customer table x and y fields...
I will test this out on a test database...
New to this site and new to learning SQL so hopefully this is an acceptable post:
I have two tables in MSSQL, one that contains a field with concatenated data that I need to query and put the data into two separate fields in another table.
Table - Contact
I identify the correct records when...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.