Short answer: YES. This question crops up regulary.
The SQL Standard mandates only that column names set with AS be reliably returned. Otherwise each implementation is free to choose whatever name it deems appropriate, because - by omitting the AS clause - you state that you "don't care". The column name may be the unqualified or qualified field name or even the text of the expression. It may also change between executions of the same query, usually because the "shape" of your data has changed enough to make the query planner choose a different sequence of joins. Since your programming environment does seem to care about column names, you will have to set them explicitly. -----Ursprüngliche Nachricht----- Von: sqlite-users-boun...@mailinglists.sqlite.org [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Chris Locke Gesendet: Donnerstag, 21. Juli 2016 23:20 An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Betreff: [sqlite] [System.Data.SQLite.DLL] Retrieving table names with column names I've a table I'm calling recursively. CREATE TABLE "staff" ( `id` TEXT, `logonName` TEXT, `firstname` TEXT, `surname` TEXT, `departmentId` TEXT, `managerId` TEXT, `holidayDaysEntitlement` INTEGER, `holidayDaysTaken` REAL, PRIMARY KEY(`id`) ) managerId points to the same table, so my join is simply: select * from staff inner join departments on staff.departmentId=departments.id inner join staff as managers on staff.managerId=managers.id This works fine using DB Browser for SQLite, and adding WHERE clauses like ' managers.id='1' ' etc. (apologies for wrapping that in quotes...) Anyway. Using system.data.sqlite.dll in vb.net, only the field names are returned. Using this statement doesn't work: dim s1 as string=sqlReader("managers.firstname").ToString Retrieving the 12th field, gives me just 'firstname' MsgBox(sqlReader.GetName(11)) I know I can change my SQL statement to be explicit, and select each required field and use AS, but is that the only solution? Thanks, Chris _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick Software Engineer Scientific Games International GmbH FN 157284 a, HG Wien Klitschgasse 2-4, A-1130 Vienna, Austria Tel: +43 1 80100 0 E-Mail: h...@scigames.at This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users