Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.
declare @c_id numeric(18,0) declare @c_lat float declare @c_lng float declare @c_state varchar(20) declare zc CURSOR FOR select id, latitude, longitude, state from zips (nolock) where zip_type = 'CA' open zc fetch next from zc into @c_id, @c_lat, @c_lng, @c_state -- iterate over "main" zip code list while @@FETCH_STATUS = 0 begin declare @t_id numeric(18,0) -- check if there are any zip codes in the new list that are <= 25 miles away from the current iterator zip set @t_id = (select top 1 id from zips (nolock) where zip_type = 'CA-25' and state = @c_state and ROUND( SQRT( POWER((69.1 * (@c_lat - latitude)), 2) + POWER((53 * (@c_lng - longitude)), 2)), 1) <= 25) -- add the iterator zip into the new list if no matches are found if @t_id is null begin insert into zips (zip, city, state, latitude, longitude, zip_type, wban_latitude, wban_longitude) select zip, city, state, latitude, longitude, 'CA-25', wban_latitude, wban_longitude from zips where id = @c_id end fetch next from zc into @c_id, @c_lat, @c_lng, @c_state end close zc deallocate zc
|How to Migrate from SQL to MYSQL in .net Web Application||2||27|
|SQL 2016 where are the managment tools?||4||22|
|SQL Select Query problems||10||36|
|Set the max value for a column||7||21|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
23 Experts available now in Live!