Hey Ben - funnily enough I hit this problem last week converting some Oracle portlets to MSSQL (2008 for the record)...
I failed to solve it though, I put this down to the way MSSQL processed the query.
What I found was where I had a NSQL portlet on Oracle using the "wrapper" technique like this
@SELECT some NSQL stuff@
FROM
(
WITH my_tab as
( SELECT some other SQL stuff FROM somewhere)
SELECT something from my_tab
)
WHERE @FILTER@
then that just did not parse in MSSQL - it seems that it does not let me wrap the "
WITH" bit - (I can use the "WITH" clause in MSSQL but it seems to need to be the 'outermost' level, no use to me in a portlet). :sad
So I gave in and recoded the NSQL as
@SELECT some NSQL stuff@
FROM
(
SELECT something from ( SELECT some other SQL stuff FROM somewhere) my_tab
) my_select
WHERE @FILTER@
which makes my code really unreadable now :sad
So I too would be interested if someone else has some expert-MSSQL insight into this
(I'd never even logged into a SQLServer database until last week, so I disqualify myself from any expertise in this area! cool) )
--
EDIT - and reading that thread which you referenced above (which I had posted in originally!!!!) confirms what i was hitting last week. :unsure: