Home > Archive > Microsoft SQL Server forum > August 2005 > File / table description.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author File / table description.
MF

2005-08-24, 9:23 am

Newby question but can't find it myself.

How can I get a file-description from a file / table ?

eg. the decription must deliver the following info:

Record nr.
Field nr.
Fieldname
Field description
Data type
Lenght
Decimals

etc....

Can somebody please tell me what to do?

Thanx
MF
Madhivanan

2005-08-24, 9:23 am

Is this?

Select * from information_schema.columns where table_name='yourTabl
e'

Madhivanan

MF

2005-08-24, 11:24 am

Madhivanan wrote:
> Is this?
>
> Select * from information_schema.columns where table_name='yourTabl
e'
>
> Madhivanan
>


Doesn't work, but thanx for the response.
Simon Hayes

2005-08-24, 11:24 am

You'll probably have to combine a few different things to get those
details - check out sysobjects, syscolumns, object_name(),
objectproperty(), columnproperty() and fn_listextendedprope
rty() in
Books Online. You could also have a look at the source for sp_help,
which returns most of the items you're interested in.

If you can't work out what you're looking for, I suggest you post a
simple CREATE TABLE statement (or perhaps use to a table in the pubs
database as an example), and show what your desired output would look
like for that table - that will probably be clearer than a description.
You might also want to clarify why Madhivanan's suggestion didn't work
for you.

Simon

Erland Sommarskog

2005-08-24, 8:24 pm

Madhivanan (madhivanan2001@gmai
l.com) writes:
> Is this?
>
> Select * from information_schema.columns where table_name='yourTabl
e'


Select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='yourTabl
e'

This matter with a case-sensitive collation. And the names in
INFORMATION_SCHEMA is all in uppercase.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

MF

2005-08-25, 7:23 am

Thanx a lot all of you. I was looking in the Master db for these files,
combining them will be difficult but I'll give it a try.

TY


Simon Hayes wrote:
> You'll probably have to combine a few different things to get those
> details - check out sysobjects, syscolumns, object_name(),
> objectproperty(), columnproperty() and fn_listextendedprope
rty() in
> Books Online. You could also have a look at the source for sp_help,
> which returns most of the items you're interested in.
>
> If you can't work out what you're looking for, I suggest you post a
> simple CREATE TABLE statement (or perhaps use to a table in the pubs
> database as an example), and show what your desired output would look
> like for that table - that will probably be clearer than a description.
> You might also want to clarify why Madhivanan's suggestion didn't work
> for you.
>
> Simon
>


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com