I am using the Telerik standalone Report designer - and connecting to SQL database. Tried to link to a stored procedure with dynamic query. The stored procedure executes fine and returns the results in SQL database.
Even "Execute Query" on the Telerik report wizard works fine and returns data rows.
When trying to add as a Telerik datasource it fails throwing the following error
System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near the keyword 'UNION'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at Telerik.Reporting.Processing.Data.SqlSchemaAdapter.<GetFields>d__1.MoveNext()
at Telerik.Reporting.Processing.Data.SimpleSchemaAdapter.Fill(SimpleDataModel model)
at Telerik.Reporting.Processing.Data.SimpleDataProvider`1.GetSchemaCore()
at Telerik.Reporting.Processing.Data.DataProvider`1.Telerik.Reporting.Processing.Data.IDataProvider.GetSchema()
at Telerik.Reporting.Data.Design.DataSourceDesignerBase.Telerik.Reporting.Design.Interfaces.IDataSchemaProvider.GetSchema()
at Telerik.Reporting.Data.Design.DataSourceService.GetSchemaFromContext(Object context)
at Telerik.Reporting.Design.DataExplorerControl.<>c__DisplayClass2.<RefreshDataSource>b__0()
ClientConnectionId:b24a70f0-fdac-4dda-94a8-a732936c2ad9
Error Number:156,State:1,Class:15