I have two tables with the exact same schema in SQL Server 2008 Standard 64-bit with one exception: one is your “basic” table, one is enabled to store geographic data in the SQL Server Spatial format. I’ve included the SQL to generate the tables.
We have a mission requirement for clients to access these tables (ideally just one table, with the M$ Spatial Option) via a M$ Access front-end through linked tables. This database contains several other tables that have been working great in Access through linked tables, and dbo.non_spatial also works fine. dbo.spatial, however, when attempting to create a linked table in access to dbo.spatial, returns the error in Access “-7477” and the table does not link. I have tried every single possible permutation of options in DSN, file, user, system, turning trace on, and no clue to the error reveals itself. By recreating dbo.spatial to dbo.non_spatial, the linked table works, which leads me to believe that the Microsoft Spatial Schema is not available to Access as a linked table. I cannot find any documentation to substantiate this. I tried a view, without Shape[geometry] column, and Access can see the table to link to it, but it takes 20-30 minutes to populate the view in Access, and I am not really interested in using views as a workaround, as that would results in having to maintain views for many more spatial tables. So….how can I link to SQL spatial tables in Access?
/****** create a non-spatial table******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[non_spatial]
[OBJECTID] [int] NOT NULL,
[FCategory] [nvarchar](16) NOT NULL,
[MapMethod] [nvarchar](4) NOT NULL,
[HError] [nvarchar](50) NOT NULL,
[MapSource] [nvarchar](255) NULL,
[SourceDate] [datetime2](7) NULL,
[EditDate] [datetime2](7) NOT NULL,
[Notes] [nvarchar](255) NULL,
[Species_Community] [nvarchar](50) NOT NULL,
[Location_ID] [uniqueidentifier] NOT NULL,
[Site_ID] [uniqueidentifier] NULL,
[GIS_Location_ID] [nvarchar](50) NULL,
[Meta_MID] [nvarchar](50) NULL,
[X_Coord] [numeric](38, 8) NULL,
[Y_Coord] [numeric](38, 8) NULL,
[Coord_Units] [nvarchar](50) NULL,
[Coord_System] [nvarchar](50) NULL,
[UTM_Zone] [nvarchar](50) NULL,
[Accuracy_Notes] [nvarchar](255) NULL,
[Unit_Code] [nvarchar](12) NULL,
[Loc_Name] [nvarchar](100) NULL,
[Loc_Type] [nvarchar](25) NULL,
[Updated_Date] [nvarchar](50) NULL,
[Loc_Notes] [nvarchar](255) NULL,
[Datum] [nvarchar](5) NULL,
[Watershed] [nvarchar](50) NULL,
[StreamName] [nvarchar](50) NULL,
[NHDReachCode] [nvarchar](14) NULL,
[TOPO_NAME] [nvarchar](50) NULL,
[Trail] [nvarchar](100) NULL,
[Road] [nvarchar](50) NULL,
[Elevation] [numeric](38, 8) NULL,
[LAT] [numeric](38, 8) NULL,
[LON] [numeric](38, 8) NULL,
[Population_ID] [uniqueidentifier] NULL,
[Year_] [nvarchar](4) NULL,
[WGS_DAT] [nvarchar](5) NULL,
[WGS_CS] [nvarchar](5) NULL,
[County] [nvarchar](20) NULL,
[State] [nvarchar](15) NULL,
[IsExtant] [nvarchar](3) NULL,
[IsSenstive] [nvarchar](3) NULL,
[SpeciesName] [nvarchar](125) NULL,
[SpeciesID] [nvarchar](50) NULL,
[Species_ID] [int] NULL,
[Shape] [int] NULL
) ON [PRIMARY]
GO
********************************************************************
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[spatial](
[OBJECTID] [int] NOT NULL,
[FCategory] [nvarchar](16) NOT NULL,
[MapMethod] [nvarchar](4) NOT NULL,
[HError] [nvarchar](50) NOT NULL,
[MapSource] [nvarchar](255) NULL,
[SourceDate] [datetime2](7) NULL,
[EditDate] [datetime2](7) NOT NULL,
[Notes] [nvarchar](255) NULL,
[Species_Community] [nvarchar](50) NOT NULL,
[Location_ID] [uniqueidentifier] NOT NULL,
[Site_ID] [uniqueidentifier] NULL,
[GIS_Location_ID] [nvarchar](50) NULL,
[Meta_MID] [nvarchar](50) NULL,
[X_Coord] [numeric](38, 8) NULL,
[Y_Coord] [numeric](38, 8) NULL,
[Coord_Units] [nvarchar](50) NULL,
[Coord_System] [nvarchar](50) NULL,
[UTM_Zone] [nvarchar](50) NULL,
[Accuracy_Notes] [nvarchar](255) NULL,
[Unit_Code] [nvarchar](12) NULL,
[Loc_Name] [nvarchar](100) NULL,
[Loc_Type] [nvarchar](25) NULL,
[Updated_Date] [nvarchar](50) NULL,
[Loc_Notes] [nvarchar](255) NULL,
[Datum] [nvarchar](5) NULL,
[Watershed] [nvarchar](50) NULL,
[StreamName] [nvarchar](50) NULL,
[NHDReachCode] [nvarchar](14) NULL,
[TOPO_NAME] [nvarchar](50) NULL,
[Trail] [nvarchar](100) NULL,
[Road] [nvarchar](50) NULL,
[Elevation] [numeric](38, 8) NULL,
[LAT] [numeric](38, 8) NULL,
[LON] [numeric](38, 8) NULL,
[Population_ID] [uniqueidentifier] NULL,
[Year_] [nvarchar](4) NULL,
[WGS_DAT] [nvarchar](5) NULL,
[WGS_CS] [nvarchar](5) NULL,
[County] [nvarchar](20) NULL,
[State] [nvarchar](15) NULL,
[IsExtant] [nvarchar](3) NULL,
[IsSenstive] [nvarchar](3) NULL,
[SpeciesName] [nvarchar](125) NULL,
[SpeciesID] [nvarchar](50) NULL,
[Species_ID] [int] NULL,
[Shape] [geometry] NULL,
CONSTRAINT [R26_pk] PRIMARY KEY CLUSTERED
(
[OBJECTID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 75) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[spatial] WITH CHECK ADD CONSTRAINT [g6_ck] CHECK (([SHAPE].[STSrid]=(26917)))
GO
ALTER TABLE [dbo].[spatial] CHECK CONSTRAINT [g6_ck]
GO
In Access, you can link to non_spatial but can’t link to spatial!
As it turns out, this is a documented “feature”! The work-around is to create a view without the geometry column, and link to the view