Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. SELECT CAST(2 AS TINYINT) AS LocationType, a.Name AS FullName,
  2. StateId, a.Name, Boundary.STAsText() AS Boundary,
  3. CentrePoint.STAsText() AS CentrePoint
  4. FROM [dbo].[States] a
  5. WHERE @BoundingBox.STIntersects(a.Boundary) = 1
  6.  
  7. /****** Object: Index [SPATIAL_States_Boundary]
  8. Script Date: 07/28/2010 18:03:17 ******/
  9. CREATE SPATIAL INDEX [SPATIAL_States_Boundary] ON [dbo].[States]
  10. (
  11. [Boundary]
  12. )USING GEOGRAPHY_GRID
  13. WITH (
  14. GRIDS =(LEVEL_1 = HIGH,LEVEL_2 = HIGH,LEVEL_3 = HIGH,LEVEL_4 = HIGH),
  15. CELLS_PER_OBJECT = 1024, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF,
  16. DROP_EXISTING = OFF, ALLOW_ROW_LOCKS = ON,
  17. ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  18. GO
  19.  
  20. SELECT CAST(2 AS TINYINT) AS LocationType, a.Name AS FullName,
  21. StateId, a.Name, Boundary.STAsText() AS Boundary,
  22. CentrePoint.STAsText() AS CentrePoint
  23. FROM [dbo].[States] a WITH (INDEX(SPATIAL_States_Boundary))
  24. WHERE @BoundingBox.STIntersects(a.Boundary) = 1
  25.  
  26. EXEC sp_executesql N'
  27. SELECT CAST(2 AS TINYINT) AS LocationType, a.Name AS FullName,
  28. StateId, a.Name, Boundary.STAsText() AS Boundary,
  29. CentrePoint.STAsText() AS CentrePoint
  30. FROM [dbo].[States] a
  31. WHERE @BoundingBox.STIntersects(a.Boundary) = 1'
  32. , N'@BoundingBox GEOGRAPHY', @BoundingBox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement