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 2005 Forums
 SQL Server Administration (2005)
 User Table columns information

Author  Topic 

banersa
Starting Member

8 Posts

Posted - 2011-09-21 : 06:43:54
Hi,

Can you please which queries will give user table information for whole database like column name, data type, length and precision

Or any other way to find out above information in the database apart from queries.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-21 : 07:14:28
[code]SELECT c.* FROM INFORMATION_SCHEMA.COLUMNS c
JOIN INFORMATION_SCHEMA.TABLES t
ON t.TABLE_NAME = c.TABLE_NAME
AND t.SCHEMA_NAME = c.SCHEMA_NAME
WHERE t.TABLE_TYPE='BASE TABLE'[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

banersa
Starting Member

8 Posts

Posted - 2011-09-21 : 07:53:29
Hi ,

The above as worked with slight modification in sql server 2008-R2
SELECT c.* FROM INFORMATION_SCHEMA.COLUMNS c
JOIN INFORMATION_SCHEMA.TABLES t

ON t.TABLE_NAME = c.TABLE_NAME
AND t.TABLE_SCHEMA = c.TABLE_SCHEMA
WHERE t.TABLE_TYPE='BASE TABLE'

can you please also let me know how to check the length of data type also.
Go to Top of Page
   

- Advertisement -