I am trying to update a SQL table column based on where the features of that table are contained within specific polygons(from a .tab table).  The code below gives me a temp table on my C drive with the column properly updated.  What I can't figure out is how to get the values in that column on the temp table to update the SQL table where primary id = primary id?

Hope that makes more sense.
-Bob

"Ian Tidy" <[EMAIL PROTECTED]> on Tuesday, October 03, 2006 at 3:30 PM -0700 wrote:
Bob,
 
Couple of things, first have you tried adding 'Server hdbc Commit' and / or 'Server Refresh temp_tablename'.
 
What is sounds to me like you are trying to do is update a SQL table based where the features of that table intersect specific polygons.  Is that correct?
 
If this is what you are trying to do, then that is easy enough.
 
The code you show modifies the SQL table structure, and you cannot do it this way.
 
Sorry I can't correct your code, I don't fully understand what you are trying to do.  If you can explain what your are trying to do a bit more, then I might be able to offer some suggestions.
 
Cheers Ian


______________________
Ian Tidy
GIS Administrator
Works Asset Department
Napier City Council
Hastings St, Private Bag 6010, Napier, New Zealand
Phone +64-6-835-7579 Ext. 8115
Fax +64-6-834-4195
mailto:[EMAIL PROTECTED]
http://www.napier.govt.nz 




From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Robert DeRubeis
Sent: Wednesday, 4 October 2006 9:43 a.m.
To: mapinfo-l@lists.directionsmag.com
Subject: [MI-L] update sql server column


I'm trying to write a mapbasic app that will update a table in a SQL server 2000 database from a .tab polygon table where the polygon table contains the table in SQL server (which has lat and long fields from which I can create points).  Is this possible to do?

I've connected to the sql server using the following code-
__________________________________________________
Dim hdbc as Integer
Dim hstmt as Integer

hdbc=server_connect("QELIB",  connect_string)
hstmt=server_execute(hdbc, "Select * from tablename")
Server hstmt Fetch Into "temp_tablename"
Server hstmt close
Open table "c:\polygonboundary.TAB" Interactive
Set style symbol makesymbol(32,255,10)
Create map for temp_tablename coordsys earth projection 1,74
Update temp_tablename
        Set Obj-CreatePoint(Long, Lat)
Commit Table temp_tablename Interactive
Add Column "temp_tablename"(column) From polygonboundary Set To 'column of polygonboundary' Where Contains
Commit Table temp_tablename Interactive
Server hdbc Disconnect
__________________________________________________
The above code will only update the temp_tablename and NOT the table in SQL server.  I also tried the following server command- hstmt=Server_Execute(hdbc, "Update tablename Set column_name=700"), which worked and changed the rows in the SQL table, but does not account for where the polygon table contains the points.

Any help is appreciated.

Thanks,
Bob
_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to