Exclude a Field in Select * From Table

The subject says all !

Select * From Table return all Fields presents in the RecordSet.

How do I exclude, say, the Unique ID Field ?

name all other fields.

Or create a View that does not contain the excluded field :slight_smile:

Thank you Christian.

That is what I do not want to do :frowning:

There is no other way.

Well, you only need to create the View once and then use it as a regular table.

SELECT * FROM your_view

Run a SELECT * … LIMIT 1 to get all the fields. Cycle through the fields concatenating where rs.IDX(FieldNumber).Name <> “id” then rerun the SELECT command with this new string of names.

And the obvious question: why bother?
When you use the data returned, just don’t use the primary key field.

The problem with select * is you dont know what you are going to get.
Someone may have changed the table since last time you came here, and added 6 new fields which you ALSO dont want.

Creating a view, or a statement that selects just the wanted fields is a good way to resolve both issues.

Thank you for the answers, David, Jeff.

David: this comes to mind yesterday, but I was not good enough (my mind was elsewhere… or nowhere) and I shut down the computer when I saw I was unable to achieve something.
Also, I wrote the SQLite Data Base prototype code some times ago and I really… have to learn what it does :frowning: [memory troubles] before I can continue. I may create a simple project to be able to skip the troubles to have a … 30MB project to deal with. Then, when this will be working, I will merge the code where needed.

Jeff: I do not wanted to show the Unique ID (to not bother the user; I also have, sometimes a Matrix #: a number that starts at 1 for the first Row and ends with the last Row and is unique, but displayed using format to fill leading zeroes *)

When you use the data returned, just don’t use the primary key field.
Using David trick ?

  • I need this “number” since I do not always have the needed dates and so this gaves me a real vision / flow of what is inside the data base. Hard to explain without going into details. Say that a Row have a Matrix # (1 is for the first date) AND a published date: I can Sort based on these (one or the other).