Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have the following select Query :

Dim count As Integer
Select count(*) as mycount from some_table into temp_table
Fetch First From temp_table
count = some_table.mycount

But it sends error:

Expression does not evaluate to string

Now when I saved temp_table to *.tab file it has char column.How to make some_table.mycount a number?

But when the Query is

Select count(*) from some_table into temp_table

It would work but column name is random.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Try this in stead:

Dim count As Integer
Select count(*) "mycount" from some_table into temp_table
Fetch First From temp_table
count = temp_table.mycount
share|improve this answer
    
Thanks For Reply How do I know what kind of query are supported in Mapinfo –  kinkajou Aug 18 '11 at 8:38
    
What queries? Are you looking for some desciption on the syntax? If yes, I would recommend that you have a look in the MapBasic reference guide and in the MapInfo Help system. –  Peter Horsbøll Møller Aug 18 '11 at 17:54
    
Thanks for information :) –  kinkajou Aug 19 '11 at 3:48
    
@Peter,is it possible to call an alias for the table,like select ... from some_table "Some" ?? –  Myra Aug 25 '11 at 11:56
    
No sure why you would want to do that? I know that is possible in most database systems, but MapInfo Pro doesn't support that. What you could do, is opening your table with an alias (if you do it thru MapBasic that is - the Open dialog doesn't support that) –  Peter Horsbøll Møller Aug 26 '11 at 7:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.