Exporting from SQL2008 Spatial using OGR
$ ogr2ogr -f KML -s_srs "EPSG:4326" -t_srs "EPSG:4326" -where "mytable_id = 6850" myexporteditem.kml "MSSQL:dsn=MY_DSN;server=(local);database=DBNAME_HERE;tables=myscheme.mytable;uid=USER_HERE;pwd=PWD_HERE" mytable
Setup PHP driver for SQL 2008
IMPORTANT: this was drafted in 2011/03, so it could easier nowadays ;-)
- copy file php_sqlsrv_53_ts_vc9.dll to PHP extensions path
- enable it at php.ini and run some phpinfo() to check it out
A *downgrade* to MsSqlSpatial (SQL 2005 lib)
After some tests using native spatial functions/types of SQL2008, I just simply gave it up for trying a new approach: MsSqlSpatial again! It's a .NET lib originally created for SQL Server 2005 and deploys OGC SFS functions and types into a SQL2005 database. Because it's .NET based, it can also be installed with SQL2008 and despite you will not get a full-featured spatial database just like PostGIS does, it will certainly run faster(very) than native 2008 spatial resources - and yes, it also lacks of enough documentation from Microsoft.
Finally, login to your database using MS SQL Studio and then expand 'Programability' node at left treeview - you will see a lot of function names starting with "ST_"
EXECUTE ST.AddGeometryColumn 'dbo','myspatialtable','geom_2005',4326,'GEOMETRY'
Then populate your new table and try to draw some map using MapServer and a virtual OGR datasource: