TSQL GET ALL COLUMNS IN TABLE 1

TSQL GET ALL COLUMNS IN TABLE

/*Get all columns from a table (sql server)*/
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'table name';

Here is what the above code is Doing:
1. We’re selecting all the columns from the INFORMATION_SCHEMA.COLUMNS table.
2. We’re filtering the results to only include rows where the TABLE_NAME column is equal to the table name we want to query.

Similar Posts