50 likes | 165 Views
Geographic Data Model Group. Conventions. Tables names preceeded by ‘tbl’. Example: tblLocation, tblRoad. Similarly query names start with ‘qry’ and stored procedure names start with ‘prc’. All road segments heading in the north south direction are numbered from 0 - 1000.
E N D
Conventions • Tables names preceeded by ‘tbl’. • Example: tblLocation, tblRoad. • Similarly query names start with ‘qry’ and stored procedure names start with ‘prc’. • All road segments heading in the north south direction are numbered from 0 - 1000. • All road segments heading in the east west direction are numbered from 1000 onwards.
Zones • tblZone has the following fields: • ZoneNorth • ZoneSouth • ZoneEast • ZoneWest • These fields will give the neighboring zone once the direction is specified.
Name : Find_Zone Input : LocationID Returns : LocationZoneID Function : This procedure returns the ZoneID of the Source/Destination selected. Pseudo Code : create procedure Find_Zone SELECT LocationZoneID FROM tblLocation WHERE LocationID = ‘X’ Name : Find_Name Input : LocationID Returns : LocationName, LocationDescription Function : This procedure returns the name and description of the Source/Destination selected Pseudo Code : create procedure Find_Name SELECT LocationName, LocationDescription FROM tblLocation WHERE LocationID = ‘X’ StoredProcedures/Queries
Stored Procedures/Queries (2) • Name : Find_Neighbor • Input : ZoneID, Direction • Returns : Zone(Direction)ID • Function : This procedure returns the ID of neighboring zone in the given direction for input zone. • Pseudo Code : create Find_Neighbor @ZoneID, @Direction as switch @direction case “North” : SELECT ZoneNorthID FROM tblZone WHERE ZoneID = @ZoneID case “South” : SELECT ZoneSouthID FROM tblZone WHERE ZoneID = @ZoneID … ...