Expression does not evaluate to a column or table name error

39 views
Skip to first unread message

Marijan

unread,
Apr 2, 2025, 3:21:52 PMApr 2
to MapInfo-L
A very common error when someone builds query and execute it with Run Command,  however I have working code that I've been using for couple of years and in it, at very beginning of subroutine I have statement like (direct, without Run Command) : 
INSERT INTO MyTable (Col1, Col2, Col3,... OBJ) VALUES (param(1), param(2), param(3)... oMyObject),
 and after I added some code below I got error 'Expression does not evaluate to a column or table name error'. 

First I checked 10 times for column name typos (and table name), but it all checks out. Then I commented out added code, same. Finally I began isolating one by one column. It appears to be the first one, where I store Id of my object. So I hardcoded value for column and my INSERT statement looks like this:

INSERT INTO MyTable(Col1) VALUES (1)

And it throws same error. Now the funny part: when I paste above code in MapBasic console it executes without error. Anyone had similar experience, I already lost half of a work day trying to figure this out. 


Marijan

unread,
Apr 2, 2025, 3:40:36 PMApr 2
to MapInfo-L

I was about to delete this question but I decided to leave it for future me,  or anyone else. Problem was that I defined variable with same name as mentioned column. Even after commenting bottom part of code, declaration stayed at header. 

Peter Horsbøll Møller

unread,
Apr 3, 2025, 2:49:01 AMApr 3
to mapi...@googlegroups.com

Thanks for not deleting it, Marijan.

 

I think many of us have been in a similar situation only to realize what you realized after spending a long time trying to make sense of it.

In most cases, this is as you wrote, caused by a variable having the same name as a table or column.

 

Cheers

Peter

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of Marijan
Sent: 2. april 2025 21:41
To: MapInfo-L <mapi...@googlegroups.com>
Subject: [MI-L] Re: Expression does not evaluate to a column or table name error

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

 

 

I was about to delete this question but I decided to leave it for future me,  or anyone else. Problem was that I defined variable with same name as mentioned column. Even after commenting bottom part of code, declaration stayed at header. 

--
--
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.
To view this discussion visit https://groups.google.com/d/msgid/mapinfo-l/aac9b0e3-3047-4be4-ac22-5c699a05bb33n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages