您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
在winform程序开发中,涉及到对某个表的组合查询时会到数据库中提取表的字段名和说明,以便于用户选择查询,在C#中使用语句比较麻烦,写到存储过程中就比较方便了。
USE [schoolDB] GO /****** Object: StoredProcedure [dbo].[sp_showcolumn] Script Date: 06/03/2016 16:45:26 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER proc [dbo].[sp_showcolumn] @tablename varchar(30) as select c.name as 字段名,p.value as 说明 from sysobjects o left join syscolumns c on o.id=c.id left join sys.extended_properties p on p.major_id=c.id and p.minor_id=c.colid and p.name='MS_Description' left join systypes t on c.xusertype=t.xusertype where o.type='u' and o.name=@tablename
查询更多信息的sql语句:
select o.name as tableName,c.name as columnName,t.name as columnType,p.value as columnDescription from sysobjects o left join syscolumns c on o.id=c.id left join sys.extended_properties p on p.major_id=c.id and p.minor_id=c.colid and p.name='MS_Description' left join systypes t on c.xusertype=t.xusertype where o.type='u' and o.name='cdxmain'
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。