Video #136
In this video I show you how to generate random Ordnance Survey 6-digit coordinates and a single integer value.
To create a single value in a column that is totally random:
Update [SQLserverAGPRO].[dbo].[yourtable] set dbo.yourtable.statsdata = CAST(RAND(CHECKSUM(NEWID()))*500 as int);
Change the 500 to any number and that will be the ceiling. So if changed to 1000 it will randomize up to 1000.
For randomizing OS grid coordinate:
The formula is:
SELECT RAND()*(b-a)+a;
Where a is the smallest number and b is the largest number that you want to generate a random number for.
Effectively a box from Coventry up to to Grantham:
X:
Update [SQLserverAGPRO].[dbo].[MYDEMOTABLE] set dbo.mydemotable.X = CAST(RAND(CHECKSUM(NEWID()))*(491402- 433644)+433644 as int);
Y:
Update [SQLserverAGPRO].[dbo].[MYDEMOTABLE] set dbo.mydemotable.Y = CAST(RAND(CHECKSUM(NEWID()))*(335825-278970)+278970 as int);
[The NEWID() function in SQL Server returns a unique id or a random value]
After creating the random coordinates, they are mapped in ArcGIS Pro using Display XY function.
But could be mapped in any GIS of course that connects to the table in the database....QGIS, MapInfo...