MS SQL linked table is read only

66 views
Skip to first unread message

Dmitry Stepanov

unread,
Jan 25, 2018, 6:47:39 AM1/25/18
to MapInfo-L
Good day!
In MS SQL i have a table with geometry column. To work with this table in MapInfo i've created a view with InsteadOf - triggers. It works fine when style information stores in database table. Now i want to set MI_STYLE in view definition like "SELECT ...,  CONVERT(VARCHAR(254), '<style definition>') AS [MI_STYLE] ...". But view with this definition opens in MapInfo as read only. So what is the problem?

Peter Horsbøll Møller

unread,
Jan 25, 2018, 7:04:24 AM1/25/18
to mapi...@googlegroups.com

The typical thing that makes MapInfo Pro make views read-only is that Pro can’t determine the Primary Key in the view.

For a base table the Primary Key column can have any name – Pro will be able to determine which column it is.

For a view, the Primary Key column needs to be called MI_PRINX.

 

You can give it an alias in the your view to make sure it has this name

 

Peter Horsbøll Møller

Pitney Bowes

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pix101

unread,
Jan 26, 2018, 2:04:01 AM1/26/18
to MapInfo-L
Peter, I think what Dmitry is alluding to is that MapInfo is reading the SQL view as Read Only as a result of a "computed" MI_STYLE.

I had the same experience over December where I spent 2 days trying to make a SQL View  Editable when I narrowed it down to my dynamic MI_STYLE (handled with a case statement in the SQL View syntax).  An unfortunate limitation.

Peter Horsbøll Møller

unread,
Jan 26, 2018, 2:11:32 AM1/26/18
to mapi...@googlegroups.com

You are right. That’s another possibility.

 

Pro see the MI_STYLE column as part of the spatial object and therefor it requires it to be “writeable”.

I ran into a similar issue when I used a join to merge a table with spatial data with another table with the style information.

It was a nice way to create “thematics” using views but had the short coming of a read-only table.

 

Peter Horsbøll Møller

Pitney Bowes

 

Peter Horne

unread,
Jan 29, 2018, 6:22:55 PM1/29/18
to MapInfo-L
Hi Dmitry,

Not sure this will help and it's a bit of a hack solution, I open the linked tab file for the SQl view in Notepad and edit by removing the "Read Only" text(s), then save.

Dmitry Stepanov

unread,
Feb 2, 2018, 2:27:13 AM2/2/18
to MapInfo-L
Hi Peter! Thanks for the advice, will try it.
Reply all
Reply to author
Forward
0 new messages