USE INFORMATION_SCHEMA; SELECT CONCAT('/// <summary> /// ',COLUMN_COMMENT,' /// </summary> public ', CASE DATA_TYPE WHEN 'bigint' THEN 'int' WHEN 'tinyint' THEN 'int' WHEN 'varchar' THEN 'string' WHEN 'varbinary' THEN 'string' WHEN 'text' THEN 'string' WHEN 'char' THEN 'string' WHEN 'datetime' THEN 'DateTime' WHEN 'bit' THEN 'bool' WHEN 'decimal' THEN 'decimal' ELSE DATA_TYPE END, ' ',COLUMN_NAME,' {get;set;}') FROM COLUMNS WHERE TABLE_SCHEMA='{DBName}' AND TABLE_NAME='{TableName}';