请问如何在SQL2005中获得系统所有数据库,指定数据库的所有表以及指定数据库的指定表的所有字段,以及字段的类型,长度等~

jackyhzzjcn 2006-06-19 07:54:00
或如何在.Net Framework 2.0中取得以上数据?
...全文
237 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
jackyhzzjcn 2006-06-22
  • 打赏
  • 举报
回复
非常感谢各位帮助,问题已解决。
laoliu666 2006-06-19
  • 打赏
  • 举报
回复
高人
athossmth 2006-06-19
  • 打赏
  • 举报
回复
select * from sys.databases
select * from information_schema.tables
select * from information_schema.columns
jackyhzzjcn 2006-06-19
  • 打赏
  • 举报
回复
非常感谢,我看一下
蒋晟 2006-06-19
  • 打赏
  • 举报
回复
Schema Discovery

Schema discovery allows applications to request managed providers to find and return information about the database schema of the database a given connection is connected to. Different database schema elements such as tables, columns and stored-procedures are exposed through the GetSchema methods of each provider's Connection class. For more information, see
http://msdn2.microsoft.com/en-us/library/kcax58fh.aspx
蒋晟 2006-06-19
  • 打赏
  • 举报
回复
Schema Discovery

Schema discovery allows applications to request managed providers to find and return information about the database schema of the database a given connection is connected to. Different database schema elements such as tables, columns and stored-procedures are exposed through the GetSchema methods of each provider's Connection class. For more information, see
http://msdn2.microsoft.com/en-us/library/kcax58fh.aspx
athossmth 2006-06-19
  • 打赏
  • 举报
回复
SELECT c.[id], object_name(c.[id]) obj_name, c.colid, c.[name], t.[name] type, c.length, c.isnullable, c.xprec, c.xscale,
(select m.[text] from dbo.syscomments m where m.[id]=c.cdefault) defaultvalue,
(select p.[value] from sys.extended_properties p where p.major_id=c.id and p.minor_id=c.colid and p.[name] = 'MS_Description' ) description
FROM dbo.syscolumns c, dbo.systypes t
WHERE (c.name <> 'dtproperties')
AND c.xusertype = t.xusertype
ORDER BY obj_name, c.colid

jackyhzzjcn 2006-06-19
  • 打赏
  • 举报
回复
不过似乎无法取得字段的Dsecription属性了?

6,129

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 新技术前沿
社区管理员
  • 新技术前沿社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧