2016-07-25 71 views
0

当在Excel中的Microsoft查询中使用SQL CTE以如下参数:SQL CTE在Excel中使用微软的查询参数

;with cte1 as (SELECT ID ,Item.ItemLookupCode 
FROM Item 
where item.Notes like '%'+?+'%'), 
cte2 as (select ItemID from Trans 
where Time between ? and ?) 
select cte1.ItemLookupCode,cte2. 
,cte2.ItemID 
from cte1 join cte2 
on cte1.ID = cte2 .ItemID 

我收到以下错误

[微软] [ODBC SQL Server驱动程序]无效的参数编号
[微软] [ODBC SQL Server驱动程序]无效的描述符索引

有人能帮助我吗?

回答