SQL server queries all table names, field names, types, lengths, stored procedures, view creation statements, and SQL stored procedures.
-- Obtain the stored procedure creation statement select o. xtype, o. name, cm. text from syscomments cm inner join sysobjects o on o. id = cm. id where xtype = 'P' order by o. xtype, o. name, cm. text -- Obtain the view creation statement select o. xtype, o. name, cm. text from syscomments cm inner join sysobjects o on o. id = cm. id where xtype = 'V' order by o. xtype, o. name, cm. text -- Query all table names, field names, types, and lengths. select o. name, c. name, t. name, c. length from syscolumns cinner join policypes t on c. xtype = t. xtypeinner join sysobjects o on c. id = o. idwhere o. xtype = 'U' order by o. name, c. name, t. name -- all data comes from these four tables -- select * from sysobjects -- select * from syscolumns -- select * from syscomments -- select * from policypes