0

Looking for JDBC SQL code to fetch default column names from table which has list of columns. is there any SQL command or query to fetch default column names from table.

  • 2
    What do you mean by 'default column names'? Column names have no defaults. – Tangentially Perpendicular Jun 23 '22 at 22:56
  • Are you referring to [`DatabaseMetaData::getColumns`](https://docs.oracle.com/en/java/javase/17/docs/api//java.sql/java/sql/DatabaseMetaData.html#getColumns(java.lang.String,java.lang.String,java.lang.String,java.lang.String))? – andrewJames Jun 24 '22 at 00:58
  • Does this answer your question? [getting column names in JDBC](https://stackoverflow.com/questions/6896737/getting-column-names-in-jdbc) If not, then can you [edit] your question and clarify what you are trying to do? – andrewJames Jun 24 '22 at 00:58
  • @Tangentially Perpendicular. Example: Say Account table has column 1, column 2, colum 2 ....... column 10. In reports, only 5 columns are displayed as default. If I want to capture & validate the 5 columns names prsent or not in report, how do I do using JDBC,SQL? – Automation tester Jun 24 '22 at 01:23
  • I think you're labouring under a misapprehension. There are no default columns in SQL. The columns appearing in a report are governed by the query used to select the data. It's possible that the system you're working with has some table that defines the default columns, but you'd need us to know about your specific system to answer your question. – Tangentially Perpendicular Jun 24 '22 at 01:46
  • "_In reports, only 5 columns are displayed as default._" - that sounds like it has more to do with the reporting tool you are using (whatever that may be) and nothing to do with JDBC or SQL `select` statements. Please [edit] your question to clarify what the specific problem is you are trying to solve. – andrewJames Jun 24 '22 at 13:39

0 Answers0