/****** Object:  Table [dbo].[Geometries]    Script Date: 02/27/2013 12:03:14 ******/

CREATE TABLE [dbo].[Geometries](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Geom] [geometry] NOT NULL,
 CONSTRAINT [PK_Geoemtries] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO


CREATE SPATIAL INDEX [SPATIAL_Geometries] ON [dbo].[Geometries] 
(
	[Geom]
)USING  GEOMETRY_GRID 
WITH (
BOUNDING_BOX =(3462000, 5542000, 3486000, 5566000), GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM), 
CELLS_PER_OBJECT = 16, PAD_INDEX  = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO

/****** UserDefinedFunction [dbo].[GetGeometries]  ******/

CREATE FUNCTION [dbo].[GetGeometries] 
(	
)
RETURNS TABLE 
AS
RETURN 
(
	SELECT * FROM dbo.Geometries
)
GO
