Okay, So i am trying to get SQL Server to generate random points for each Zip code, for each LocationID. So I have added the center point for each Zip code, and would like to distribute these points around the center point. For each locationID I would like a point. Here is what my table looks like currently.
Table name= Location
LocationName; varchar locationID; int ZIP: int CentroidLat;float CentroidLng;float
LocationName LocationID Zip CentriodLat CentroidLNG
JV 1 99999 38.999999 - 93.999999
JV 2 99999 38.999999 - 93.999999
AA 1 11111 37.999999 - 94.999999
AA 2 11111 37.999999 - 94.999999
AA 3 11111 37.999999 - 94.999999
BB 1 22222 36.999999 - 95.999999
BB 2 22222 36.999999 - 95.999999
So for each zip's LocationId I would like a random lat long within the Zip Code. I could get this in a square or circle that would work fine. It does not need to be too exact. Also each Zip Code is going to be a different size so if there could be a variable that i could change manually in the code that would be great!
Is this possible???????????
I found this... SQL Server generating random spatial geography around point? but cannot get it to work. I keep getting this error: "Msg 116, Level 16, State 1, Line 18 Only one expression can be specified in the select list when the subquery is not introduced with EXISTS." Errors come over when i try and insert my table name and column into the top of the code.
Thank you in advance!
Aucun commentaire:
Enregistrer un commentaire