Get Field Name and Type of Database Table

Today we will see how we can retrieve table’s columns’ names and types.

USE mydatabase
GO
 
SELECT column_name, data_type 
FROM information_schema.COLUMNS 
WHERE TABLE_NAME = 'mytable';
%d bloggers like this: