Declare @ t table (table name: varchar (100); field name: varchar (100); Data Type: varchar (100); Length: varchar (100); Description: SQL _variant)
Declare @ table varchar (100), @ counter int, @ tablecount int, @ talben varchar (100), @ A varchar (100), @ B varchar (100 ), @ C varchar (100), @ d varchar (100), @ E varchar (100)
Select @ tablecount = count (name) from sysobjects where xtype = 'U'
Declare tablen cursor
Select name from sysobjects where xtype = 'U'
Open tablen
Set @ counter = 1
While @ counter <@ tablecount
Begin
Fetch next from tablen
Into @ talben
Insert @ t select table name = case when a. colorder = 1 then D. Name else ''end,
Field name = A. Name,
Type = B. Name,
Length = columnproperty (A. ID, A. Name, 'precision '),
Field description = isnull (G. [value], '')
From syscolumns
Left join policypes B on A. xtype = B. xusertype
Inner join sysobjects D on A. ID = D. id and D. xtype = 'U' and D. Name <> 'dtproperties'
Left join syscomments e on A. cdefault = E. ID
Left join sysproperties g on A. ID = G. ID and A. colid = G. smallid
Left join sysproperties F on D. id = f. ID and F. smallid = 0
Where D. id = object_id (@ talben)
Order by A. ID, A. colorder
-- Insert @ t select @ talben
Set @ counter = @ counter + 1
End
Close tablen
Deallocate tablen
Select * From @ t
Display and print with the foreground control.