March 4, 2008 at 6:56 am
Hi All.
I'm an Oracle DBA who's currently being asked to look at a SqlServer Database. I need a list of columns per table, but am having trouble.
I'll admit I might be being lazy here, but I'm in a hurry and using the valueable resources available to me!! Would really appreciate the sql i need to copy into the query window. Much obliged!!
I need........
Table A
Column1 Datatype
Column2 Datatype
Table B
Column1 Datatype
Column2 Datatype
etc....
Many thanks.
March 4, 2008 at 7:05 am
March 4, 2008 at 7:13 am
Try this
select table_name,column_name,data_type from information_schema.columns where table_name not in (
select name from sysobjects where type='v') order by table_name
March 4, 2008 at 8:05 am
Thanks Maverik
March 4, 2008 at 9:16 am
I dont know about you, but I would want as much information as possible. I would display a few more columns.
SELECT
c.Table_Name,
c.Column_Name,
c.Data_Type,
c.character_maximum_length,
c.Numeric_Precision,
c.Numeric_scale,
c.Is_Nullable,
c.Column_Default,
c.Collation_Name
FROM INFORMATION_SCHEMA.COLUMNS c
INNER JOIN SYS.TABLES so
ON c.Table_Name = so.Name AND so.Type = 'U'
March 4, 2008 at 9:54 am
I gotta agree with that...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply