create table #temp
(
XX char(10)
)
insert into #temp values('C_01')
select * from #temp
select C_01 from paydatac
---
declare @C_01 varchar(4)
select @C_01=XX from #temp
exec('select '+@C_01+' from paydatac')
---
select (select XX from #temp) from paydatac
第1个回答 2010-12-13
点评:
方法一:只能查询到#temp表中的xx字段的最后一个值在paydatac表的数据;
方法二:子查询没有错,但外面应该用paydatac的这个字段来接受(用in的方式)。
谢谢!本回答被网友采纳
方法一:只能查询到#temp表中的xx字段的最后一个值在paydatac表的数据;
方法二:子查询没有错,但外面应该用paydatac的这个字段来接受(用in的方式)。
谢谢!本回答被网友采纳