日期:2014-05-17  浏览次数:20461 次

sql2005 in 查询问题
select * from StrToTable(select aaa from TBA where aid = '1')这句话不对。

StrToTable就是将查询结果为:2,3转成数据表的函数;
select aaa from TBA where aid = '1' 的结果为:2,3

为什么这句语句不对呢?应该怎么写?求教,谢谢了。

------解决方案--------------------
select * from dbo.StrToTable(select aaa from TBA where aid = '1')
报的什么错啊
------解决方案--------------------
引用:
Quote: 引用:

select * from dbo.StrToTable(select aaa from TBA where aid = '1')
报的什么错啊



消息 156,级别 15,状态 1,第 2 行
关键字 'select' 附近有语法错误。
消息 102,级别 15,状态 1,第 2 行
')' 附近有语法错误。


哦 知道了,应该是内部少了括号,改成这样试试:

select * from dbo.StrToTable((select aaa from TBA where aid = '1'))