Using SQL Server 2008R2 SP2 CU8 as the CMS from where PBM is also working against central managed servers, PBM outputs the following error when evaluating any policy based in a ExecuteSql() facet:
"Line 1: Incorrect syntax near 'max'.
Must declare the variable '@@UserScript'.
Must declare the variable '@@UserScript'. (Microsoft SQL Server, Error: 170)"
Doing a trace, this is the execution string:
DECLARE @@UserScript nvarchar(max);
SET @@UserScript = N'<my t-sql condition>;';
EXEC sp_executesql @@UserScript;
The t-sql condition in the facet is valid, but the execution in SQL 2000 is invalid due to nvarchar(max).