Home Dashboard Directory Help

PBM: Error evaluating script policies (ExecuteSql) against SQL Server 2000 by Pedro Azevedo Lopes



Sign in
to vote
Type: Bug
ID: 807827
Opened: 11/5/2013 5:14:47 PM
Access Restriction: Public
User(s) can reproduce this bug


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).
Sign in to post a comment.
Posted by Pedro Azevedo Lopes on 11/18/2013 at 8:30 AM
I am well aware that SQL 2000 is not supported anymore.
Nevertheless, at the very least, the appropriate incompatibility information between the ExecuteSql() facet and SQL Server 2000 should be added to a "Considerations for using Policy-Based Management" section in http://technet.microsoft.com/en-us/library/bb510667.aspx and http://technet.microsoft.com/en-us/library/bb510667(v=sql.100).aspx, given that SQL Server 2000 was overall supported by PBM.
Posted by Microsoft on 11/18/2013 at 8:12 AM
Hello Pedro. Thank you for your input. SQL Server 2000 is no longer supported in any context. You can find out more about support lifecycle of various iterations of SQL here: http://support.microsoft.com/lifecycle/search/default.aspx?sort=PN&alpha=sql+server&Filter=FilterNO
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
PBM_ExecuteSqlError_Repro.sql 11/5/2013 4 KB
PBM_ExecuteSqlError_Repro.sql 11/5/2013 4 KB