This is a followup to the script submitted by srallapalli. One can return a record set of all tables in a database using the following:
USE MyDatabase
SELECT so.name AS TableName, sc.name AS ColumnName, st.name AS ColumnDatatype, convert(int, sc.length) AS ColumnLength FROM syscolumns sc, sysobjects so , systypes st WHERE so.type='U' AND OBJECTPROPERTY(so.id,'ismsshipped') = 0 AND sc.id=so.id AND st.xusertype=sc.xusertype ORDER BY so.name
To get a result in more of a data dictionary format with the table name shown once only use a stored procedure as follows:
Harnessing SQL Server Metadata- Disabling and Rebuilding Indexes
When doing bulk data changes it may be beneficial to disable indexes prior to starting the operation. Fortunately, SQL's rich metadata makes this very easy to automate in a robust fashion.
2018-05-18 (first published: 2015-10-19)
4,855 reads