To all:
I recently was asked to come up with a simple script to describe a table/view column and is most useful ddl attributes. The below uses the INFORMATION_SCHEMA.COLUMNS which I happen to like for this purpose.
It is very fast and very useful, I have submitted this to the Toad-SS idea pond so as to share the code. TDA and SQL Server user should give it a try.
select table_name, Table_Schema,column_name, Ordinal_Position
...more »
To all:
I recently was asked to come up with a simple script to describe a table/view column and is most useful ddl attributes. The below uses the INFORMATION_SCHEMA.COLUMNS which I happen to like for this purpose.
It is very fast and very useful, I have submitted this to the Toad-SS idea pond so as to share the code. TDA and SQL Server user should give it a try.
select table_name, Table_Schema,column_name, Ordinal_Position
,DATA_TYPE
, isnull(cast(character_maximum_length as varchar(15)) ,'NA') as 'Char_Length' --- So as not to return nulls values.
, isnull(cast(NUMERIC_PRECISION as varchar(15)) ,'NA') as 'NUMERIC_PRECISION' --- So as not to return nulls values.
, isnull(cast(NUMERIC_SCALE as varchar(15)) ,'NA') as 'NUMERIC_SCALE' --- So as not to return nulls values.
, IS_NULLABLE
, isnull(cast(Column_Default as varchar(15)) ,'NA') as 'Column_Default'
from INFORMATION_SCHEMA.COLUMNS a
where table_name = 'MeterInventory' -- order by 3
« less
full details »
Social Web