Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql server get schema of table


-- This first query will return all of the tables in the database you are querying.
SELECT
  	TABLE_NAME
FROM
  	INFORMATION_SCHEMA.TABLES
ORDER BY TABLE_NAME


-- The second query will return a list of all the columns and tables in the database you are querying.
SELECT
  	TABLE_NAME,
	COLUMN_NAME
FROM
  	INFORMATION_SCHEMA.COLUMNS
ORDER BY TABLE_NAME
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #server #schema #table
ADD COMMENT
Topic
Name
3+1 =