VS code extension question

Hi,

Does anyone knows if there is an VS code extension which can list out all table and column names based on one specific SQL query?

Thanks and regards

Hi @doll916 welcome to the forum.

This plugin I found after a quick search might be of use: SQLTools - Visual Studio Marketplace

The question you’re really asking here though isn’t down to the plugin/tool, rather it’s how to query for those items.

You can find table names by querying the schema and the syntax is dependent on which flavour of SQL you’re using (SQL Server, MySQL, Postgres etc.) For example SQLSRV query would be:

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES

and to find columns in a table, in the order they are in the table(optional):

SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Your Table Name' ORDER BY ORDINAL_POSITION

So long as your user has privileges to query the schema and the extension can run commands, you should be able to find this information. Most extensions and SQL tools generally list the tables and columns somewhere in their UI too.

Hope that helps,
Billy :cowboy_hat_face: