I created a distance table/chart in the chart I want the ability to ada a city.
I created a stored procedure in mssql which goes something like this
ALTER PROCEDURE dbo.sup_InsertCity
(
@cityName nvarChar(50)
)
AS
Insert into citiesTest (cityName)
values (@cityName)
declare @counter int
declare @cityNumber int
declare @cityID int
SELECT @cityNumber = COUNT(idCities) FROM citiesTest
SELECT @cityID = @@Identity
set @counter = 0
while @counter < @cityNumber
begin
set @counter = @counter + 1
/*
*/
insert into DistanceTest (CityTop, CityRight, Distance, time)
values (@cityID, @counter, 0, 0)
insert into DistanceTest (CityTop, CityRight, Distance, time)
values ( @counter, @cityID, 0, 0)
end
RETURN
Now the problem is that this would only work if one didn’t delete city’s making a gap in the cities id. Instead of doing a course I would like to go thrould a collection of the id’s in the other table to assign as the second city.
Would something like this work for you: