Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Coordinates in Miles

Author  Topic 

tech2
Yak Posting Veteran

51 Posts

Posted - 2017-06-30 : 10:48:52
I have query that shows a two point coordinates and I want to convert it to miles. I'm not familiar with the Data Types. I don't know where to start? I just need pointed in the right direction. An example of a Coordinates is below.

XCoord -94.300483 (negative)

YCoord 35.323695 (positive)

Thanks

cbrammer1219
Starting Member

3 Posts

Posted - 2017-07-24 : 17:06:15
So I am trying to read data that has multiple lines for a vendor, but the name of the vendor isn't in every row. so I need to indicate that rows 1-14 are a given vendor and rows 15-20 are another vendor. I am trying to find the best way to do this.


CREATE TABLE [dbo].[TONYS_v2](
[customerfileid] [int] NULL,
[ID] [int] NULL,
[Ship to Customer] [nvarchar](10) NULL,
[sh Long Description] [nvarchar](40) NULL,
[Item Number] [varchar](25) NULL,
[Brand Code] [nvarchar](20) NULL,
[Long Description] [nvarchar](50) NULL,
[Catch Weight] [nvarchar](3) NULL,
[Item Pack] [int] NULL,
[Item Size] [nvarchar](10) NULL,
[QTY1] [int] NULL,
[QTY2] [int] NULL,
[WEIGHT1] [float] NULL,
[WEIGHT2] [float] NULL,
[Field13] [float] NULL,
[Field14] [float] NULL,
[ERP_CUSTOMER_NUMBER] [varchar](30) NULL
) ON [PRIMARY]


INSERT INTO TONYS_v2 ([ID]
,[Ship to Customer]
,[sh Long Description]
,[Item Number]
,[Brand Code]
,[Long Description]
,[Catch Weight]
,[Item Pack]
,[Item Size]
,[QTY1]
,[QTY2]
,[WEIGHT1]
,[WEIGHT2]
,[Field13]
,[Field14])
SELECT [ID]
,[Ship to Customer]
,[sh Long Description]
,[Item Number]
,[Brand Code]
,[Long Description]
,[Catch Weight]
,[Item Pack]
,[Item Size]
,[QTY1]
,[QTY2]
,[WEIGHT1]
,[WEIGHT2]
,[Field13]
,[Field14]
FROM [WH_Stores].[dbo].[TONYS_20170417]


Ship to Customer sh Long Description Item Number Brand Code Catch Weight Long Description Item Pack Item Size QTY1 WEIGHT1 WEIGHT2 Field13 Field14
17000215 TIMES SUPER #2 KAHALA 41172 Smart Chicken Y Chicken, Boneless Skinless BreastOrganic 12 1# 3 42 54 $245.45 $307.10
41220 Smart Chicken Y **JIT Chicken, Org Drum / Thigh Combo 12 1.21# 2 46 40 $134.95 $116.49
36720 Smart Chicken Y **JIT Chicken, Bnls Sknls Breast 15 1.37# 3 47 70 $214.34 $320.82
40329 Smart Chicken Y **JIT Chicken, Bnls Sknls Thighs 15 1.39# 3 61 68 $210.76 $237.10
40326 Smart Chicken Y **JIT Whole Wing Organic 6 1.44# 2 37 34 $98.03 $91.45
41171 Smart Chicken Y Chicken, Organic Thighs 9 1.5# 1 23 21 $69.08 $63.14
41173 Smart Chicken Y Chicken, Boneless Skinless Thigh Organic 12 1.5# 3 69 60 $323.25 $281.08
40692 Smart Chicken N Sausage, Organic Sweet Apple 8 12 oz 7 $31.71
36723 Smart Chicken N Chicken, Fresh Ground Breast 8 16 oz 2 20 20 $64.82 $64.82
40718 Smart Chicken N Chicken, Organic Ground Thigh 8 16 oz 2 18 18 $77.96 $77.96
41169 Smart Chicken Y Chicken, Organic Split Breast 9 2# 1 10 10 $41.44 $43.49
40320 Smart Chicken Y **JIT Chicken, Whole 6 3.61# 2 27 40 $47.48 $70.71
41168 Smart Chicken Y Chicken, Whole Organic 3 4# 2 25 39 $66.11 $102.93
17000215 Total 26 424 481 $1,593.67 $1,808.80
17000815 TIMES SUPER #8-BERETANIA 41220 Smart Chicken Y **JIT Chicken, Org Drum / Thigh Combo 12 1.21# 1 23 $69.08
36720 Smart Chicken Y **JIT Chicken, Bnls Sknls Breast 15 1.37# 1 16 17 $72.38 $78.23
40326 Smart Chicken Y **JIT Whole Wing Organic 6 1.44# 2 33 17 $87.60 $45.49
41173 Smart Chicken Y Chicken, Boneless Skinless Thigh Organic 12 1.5# 2 39 21 $182.25 $97.31
41212 Smart Chicken Y **JIT Chicken, Drumsticks 15 1.80# 1 17 18 $34.85 $36.09
40320 Smart Chicken Y **JIT Chicken, Whole 6 3.61# 2 26 14 $45.37 $25.55
41168 Smart Chicken Y Chicken, Whole Organic 3 4# 14 $38.29
17000815 Total 9 155 102 $491.53 $320.96
17001015 TIMES SUPER#10-KOOLAU 41172 Smart Chicken Y Chicken, Boneless Skinless BreastOrganic 12 1# 2 31 26 $180.48 $150.22
36716 Smart Chicken Y Chicken, Breast Boneless Skinless 15 1.37# 19 $77.95
36720 Smart Chicken Y **JIT Chicken, Bnls Sknls Breast 15 1.37# 2 32 36 $143.23 $163.34
40329 Smart Chicken Y **JIT Chicken, Bnls Sknls Thighs 15 1.39# 1 20 22 $67.92 $76.07
41173 Smart Chicken Y Chicken, Boneless Skinless Thigh Organic 12 1.5# 1 22 20 $105.65 $95.29
17001015 Total 6 105 123 $497.28 $562.87

Go to Top of Page
   

- Advertisement -