Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Getting DB schema list

Author  Topic 

JaybeeSQL
Posting Yak Master

112 Posts

Posted - 2012-06-29 : 04:56:45
Hi all, is there a SS2K script that returns all columns + their attributes within a DB??

Cheers

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-06-29 : 06:13:14
information_schema.columns
pretty sure that was available in v2000.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

JaybeeSQL
Posting Yak Master

112 Posts

Posted - 2012-07-02 : 08:51:47
This did the trick....

SELECT SysObjects.[Name] as TableName,
SysColumns.[Name] as ColumnName,
SysTypes.[Name] As DataType,
SysColumns.[Length] As Length
FROM
SysObjects INNER JOIN SysColumns
ON SysObjects.[Id] = SysColumns.[Id]
INNER JOIN SysTypes
ON SysTypes.[xtype] = SysColumns.[xtype]
WHERE SysObjects.[type] = 'U'
--And SysObjects.[Name] = 'YourTableNameHere' or SysObjects.[Name] = 'YourTableNameHere' –
--Group by SysObjects.[Name]
ORDER BY SysObjects.[Name] desc, SysColumns.[Name]
Go to Top of Page
   

- Advertisement -