• Hi,

    I tried your suggestion to use the NVARCHAR(max) to hold the MDX query of more than 8000 chars (upto 2GB) and also changed data type of parameters passing into the MDX query to NVARCHAR(MAX) but it works for relational query only. And when you try to get the data from OLAP database using Linked server and OPENQUERY function the query in the nvarchar(max) variable is reduced to nvarchar(8000). i.e., it can contain only 8000 characters in the openquery function.

    For reference :-

    http://msdn.microsoft.com/en-us/library/ms188427.aspx

    http://stackoverflow.com/questions/8151121/execute-very-long-statements-in-tsql-using-sp-executesql