{
string sql = " SELECT a.colorder N'字段序号',a.name N'字段名',(case when ColUMNPROPERTY( a.ID,a.name,'IsIDentity')=1 then '√'else '' end) N'标识',(case when (SELECT count(*) FROM sysobjects WHERE (name in (SELECT name FROM sysindexes WHERE (ID = a.ID) AND (indID in (SELECT indID FROM sysindexkeys WHERE (ID = a.ID) AND (colID in (SELECT colID FROM syscolumns WHERE (ID = a.ID) AND (name = a.name))))))) AND (xtype = 'PK'))>0 then 'yes' else '' end) N'主键',b.name N'类型',a.length N'占用字节数',ColUMNPROPERTY(a.ID,'PRECISION') as N'长度',isnull(ColUMNPROPERTY(a.ID,'Scale'),0) as N'小数位数',(case when a.isnullable=1 then '√'else '' end) N'允许空',isnull(e.text,'') N'默认值' FROM syscolumns a left join systypes b on a.xtype=b.xusertype inner join sysobjects d on a.ID=d.ID and d.xtype='V' and d.name<>'dtpropertIEs' left join syscomments e on a.cdefault=e.ID where d.name='" + vIEwtablename + "'order by object_name(a.ID),a.colorder";
sqlCommand cmd = new sqlCommand(sql,new sqlConnection(connect.connstr));
cmd.Connection.open();
DataSet ds = new DataSet();
sqlDataAdapter da = new sqlDataAdapter(cmd);
da.Fill(ds);
return ds.tables[0];
}
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
//加载字段到checkBoxList Datatable dtStoreParas = DataOp.GetVIEwtableColumn(e.Node.name); for (int m = 0; m < dtStoreParas.Rows.Count; m++) { chklColumn.Items.Add(dtStoreParas.Rows[m]["字段名"].ToString(),true); }
总结以上是内存溢出为你收集整理的如何获取SQLServer 的视图全部内容,希望文章能够帮你解决如何获取SQLServer 的视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)