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.
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.columnspretty 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. |
|
|
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 LengthFROMSysObjects INNER JOIN SysColumnsON SysObjects.[Id] = SysColumns.[Id]INNER JOIN SysTypesON 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] |
|
|
|
|
|