Still trying to read descriptions for tables, columns, etc from me

  • Thread starter Thread starter Guest
  • Start date Start date
Did you check out the GetSchema method of the ADO.NET Connection class?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
Hi,
you can try stored procedure sp_columns_rowset also.
sp_columns_rowset
The sp_columns_rowset stored procedure returns the complete columns
description, including the length, type, name, and so on.

Syntax

sp_columns_rowset table_name [, table_schema ] [, column_name]
where
table_name - is the table name. table_name is sysname.
table_schema - is the table schema. table_schema is sysname,
with a default of NULL.
column_name - is the column name. column_name is sysname,
with a default of NULL.
This is the example:
USE pubs
GO
EXEC sp_columns_rowset 'authors'
GO
 
Very strange - it has a Description column but it's null even if there is a
description for the column. Is it possible this is broken?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




Manish Bafna said:
Hi,
you can try stored procedure sp_columns_rowset also.
sp_columns_rowset
The sp_columns_rowset stored procedure returns the complete columns
description, including the length, type, name, and so on.

Syntax

sp_columns_rowset table_name [, table_schema ] [, column_name]
where
table_name - is the table name. table_name is sysname.
table_schema - is the table schema. table_schema is sysname,
with a default of NULL.
column_name - is the column name. column_name is sysname,
with a default of NULL.
This is the example:
USE pubs
GO
EXEC sp_columns_rowset 'authors'
GO
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



DavidThi808 said:
the sp_help command doesn't return descriptions as far as I can tell. Any
other ideas?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
Hi Dave,

I think it is because not all Databases(Oracle, My SQL) support Description
property that Ado.net doesn't include Description column in its schema
table. By the way, it seems neither "sp_columns" nor "sp_help" helps in
this scenario.

#1 If you just want to get description property for the special
column/table/sp, you can use fn_listextendedproperty in SQL.
For example:
select value from ::fn_listextendedproperty ('MS_Description', 'user',
'dbo', 'table', 'Table1', 'column', 'Column1')
'MS_Description' is the description property of the column that you are
looking for;
'Table1' is the table name;
'Column1' is the column for which you want the description.
You can look up the syntax and example of this function in SQL server books
online for further details.
This method works both on SQL 2005 and on SQL 2000.

#2 if you want to list all the descriptions of column/table/sp.
I suggest you may follow Paul's suggestion. The document post by Paul is
the right point.
Another option, you may check SMO.
http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.
database.extendedproperties.aspx
[Database.ExtendedProperties Property ]
Using SMO, you can get all description property from SQL server(both SQL
2000 and SQL 2005).

I haven't received the reply from product team so far. Anyway I will check
it for you. If I can get any information from there, I will also post it
here.

Sincerely,
Wen Yuan
Microsoft Online Community Support
 
Back
Top