select '' as bynd,'' as bysj from bos_mod a
where not exists(select * from sysobjects b inner join syscolumns c on c.id = b.id where b.id = object_id('table_name') and c.name in ('bynd','bysj'))
union
select bynd,bysj from bos_mod a
where exists(select * from sysobjects b inner join syscolumns c on c.id = b.id where b.id = object_id('table_name') and c.name in('bynd','bysj'))
试试这个
where not exists(select * from sysobjects b inner join syscolumns c on c.id = b.id where b.id = object_id('table_name') and c.name in ('bynd','bysj'))
union
select bynd,bysj from bos_mod a
where exists(select * from sysobjects b inner join syscolumns c on c.id = b.id where b.id = object_id('table_name') and c.name in('bynd','bysj'))
试试这个
解决方案 »
- VS2008自带的sql server2005无法开启全文索引
- 一个SQL存储过程问题
- 困扰我的引号
- 由于回复较多,贴子已结,但还是不解,故发贴再问。
- 使用xp_sendmail時如何將查詢結果當作excel附件發送出去
- 如何让SQL Server 2008 R2 开发者版与Visual Studio 2010 旗舰版连接上?
- SQL 语句的问题,请个位高手帮帮忙!!!
- 请教关于定时触发的问题,在特定的时间,对数据进行操作,将其清零,???
- 请问一个关于数据库死锁的问题
- 批量更新问题
- 我想详细了解columns_updated()用法,不知是否有相关这方面资料,谢谢
- 各位请进.????小第不明白..
select '' as bynd,'' as bysj from table_name a
where not exists(select * from sysobjects b inner join syscolumns c on c.id = b.id where b.id = object_id('table_name') and c.name in ('bynd','bysj'))
union
select bynd,bysj from table_name a
where exists(select * from sysobjects b inner join syscolumns c on c.id = b.id where b.id = object_id('table_name') and c.name in('bynd','bysj'))