Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

How do I get a list of table column names from an SQLite database? [closed]

I want to migrate my iPhone app to a new database version. Since I don't have some version saved, I need to check if certain column names exist.

This answer suggests:

SELECT sql FROM sqlite_master
WHERE tbl_name = 'table_name' AND type = 'table'

And to parse the result.

Is that the common way? Alternatives?

Answer*

Cancel
2
  • 1
    This answer is too long and overly verbose, instead of posting code, please add more detail as to how and why this presents a solution for the user, such that it can be read and understood without having to be parsed first Commented Sep 14, 2021 at 23:42
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. Commented Sep 15, 2021 at 4:18