<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi,<br>
<br>
When working with the SQL Server 2008 OGR driver I presume it is
necessary to create the following metadata tables?<br>
<br>
geometry_columns <br>
spatial_ref_sys<br>
<br>
There appears to be no way to do this automatically in Python, but
if I import a single dataset into the database it is created
automatically. I can then use: <br>
<br>
conn_string = "MSSQL:server=W08-SQL08;database=dbname;Integrated
Security=true;"<br>
ds = ogr.Open(conn_string)<br>
lyr = ds.GetLayerByName('testdata')<br>
<br>
It would be nice to be able to connect to a layer without having to
register it with the geometry_columns table using a connection
string such as:<br>
<br>
"MSSQL:server=W08-SQL08;database=dbname;Integrated
Security=true;tables=myschema.testdata(GEOMFIELD)" <br>
<br>
As this is not currently possible I manually added a record to
geometry_columns for an existing spatial table in my database. This
is in a separate schema so I used the following SQL:<br>
<br>
INSERT INTO [geometry_columns] ([f_table_catalog], [f_table_schema]
,[f_table_name],
[f_geometry_column],[coord_dimension],[srid],[geometry_type]) <br>
VALUES ('DbName', '<b>myschema</b>', 'testdata', 'GEOMFIELD', 2,
32768, 'MULTIPOLYGON')<br>
<br>
However using SQL Profiler when trying to connect to the layer it
always tries to find this layer in <b>dbo</b>. <br>
<br>
exec DbName..sp_columns N'testdata',N'<b>dbo</b>',N'DbName',NULL<br>
<br>
As it does not exist in dbo the connection never succeeds, and I
cannot connect to any of the layers in the database. <br>
I can add this to trac if it is an issue - I just want to first make
sure I've not made any obvious errors. <br>
<br>
Regards,<br>
<br>
Seth Girvin<br>
<br>
<font color="#888888">--<br>
web:</font><a href="http://geographika.co.uk"><font
color="#888888"> </font>http://geographika.co.uk</a><br>
<font color="#888888">twitter: @geographika</font><br>
<br>
<br>
</body>
</html>