Restore to SQL 2005 from SQL 2008

You cant restore a database backwards from SQL Server 2008 to a SQL 2005 Instance.

One trick you can use is to script the entire database, and ensure you select in the advanced options as shown below, SQL 2005.

Then run the script at the destination SQL 2005 instance.

Remember to change the database file paths in the output SQL script as needed.

e22

 

 

Uploading ESRI Shapefile into Microsoft SQL Server 2008 Spatial Database

Microsoft SQL Server from release 2008, 2008 R2, 2012 and above, support spatial data types.

Tool used for this – shape2sql – by Morten Nielsen/SharpGIS can be found by clicking here.

Sample test data used was downloaded from here – OpenStreetMap and  here – Processed Coastline Data

Screenshot

Capture_spatial

After import into SQL, this translated in rows/size as:

Capture_spatial2

T-SQL code for table generated:

USE [Spatial] GO
SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON GO
CREATE TABLE [dbo].[Processed_p]
(  [ID] [int] IDENTITY(1,1) NOT NULL,
[error] [smallint] NULL,
[tile_x] [int] NULL,
[tile_y] [int] NULL,
[geom] [geometry] NULL,
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] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[Processed_p]
WITH CHECK ADD  CONSTRAINT [enforce_srid_geometry_Processed_p] CHECK  (([geom].[STSrid]=(0))) GO

ALTER TABLE [dbo].[Processed_p]
CHECK CONSTRAINT [enforce_srid_geometry_Processed_p] GO