Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT CAST(2 AS TINYINT) AS LocationType, a.Name AS FullName,
- StateId, a.Name, Boundary.STAsText() AS Boundary,
- CentrePoint.STAsText() AS CentrePoint
- FROM [dbo].[States] a
- WHERE @BoundingBox.STIntersects(a.Boundary) = 1
- /****** Object: Index [SPATIAL_States_Boundary]
- Script Date: 07/28/2010 18:03:17 ******/
- CREATE SPATIAL INDEX [SPATIAL_States_Boundary] ON [dbo].[States]
- (
- [Boundary]
- )USING GEOGRAPHY_GRID
- WITH (
- GRIDS =(LEVEL_1 = HIGH,LEVEL_2 = HIGH,LEVEL_3 = HIGH,LEVEL_4 = HIGH),
- CELLS_PER_OBJECT = 1024, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF,
- DROP_EXISTING = OFF, ALLOW_ROW_LOCKS = ON,
- ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- GO
- SELECT CAST(2 AS TINYINT) AS LocationType, a.Name AS FullName,
- StateId, a.Name, Boundary.STAsText() AS Boundary,
- CentrePoint.STAsText() AS CentrePoint
- FROM [dbo].[States] a WITH (INDEX(SPATIAL_States_Boundary))
- WHERE @BoundingBox.STIntersects(a.Boundary) = 1
- EXEC sp_executesql N'
- SELECT CAST(2 AS TINYINT) AS LocationType, a.Name AS FullName,
- StateId, a.Name, Boundary.STAsText() AS Boundary,
- CentrePoint.STAsText() AS CentrePoint
- FROM [dbo].[States] a
- WHERE @BoundingBox.STIntersects(a.Boundary) = 1'
- , N'@BoundingBox GEOGRAPHY', @BoundingBox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement