select a.name asname,b.name asxtype,a.length aslength,a.xprec asxprec,a.xscale asxscale
from (select name,xtype,length,xprec,xscale from syscolumns whereid=object_id('T_HR_Employee')andnamenotin(select name from syscolumns whereid=object_id('T_HR_EmployeeSnapshot'))) a,
systypes b
wherea.xtype=b.xtype and b.name!='sysname'
例如
//人员快照表与员工表对比,查询人员快照表中缺少的字段名string sqlqueryEmp =string.Format(@"select a.name as name,b.name as xtype,a.length as length,a.xprec as xprec,a.xscale as xscale
from (select name,xtype,length,xprec,xscale from syscolumns where id=object_id('T_HR_Employee') and name not in(select name from syscolumns where id=object_id('T_HR_EmployeeSnapshot'))) a,
systypes b
where a.xtype=b.xtype and b.name!='sysname'", VersionID);DataTable dt = DbHelper.QueryForDataTable(sqlqueryEmp);//汇总查出的数据总数// int count2 = (int)this.DbHelper.QueryForScalar(sqlqueryEmp);//判断有无数据//判断汇总查出的数据总数是否大于0if(dt.Rows